{"action":"closed","number":3690,"pull_request":{"url":"https://api.github.com/repos/red/red/pulls/3690","id":241500427,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxNTAwNDI3","html_url":"https://github.com/red/red/pull/3690","diff_url":"https://github.com/red/red/pull/3690.diff","patch_url":"https://github.com/red/red/pull/3690.patch","issue_url":"https://api.github.com/repos/red/red/issues/3690","number":3690,"state":"closed","locked":false,"title":"Fix optimization phase and `s`/`u` strange behaviour in RTD","user":{"login":"toomasv","id":11960635,"node_id":"MDQ6VXNlcjExOTYwNjM1","avatar_url":"https://avatars3.githubusercontent.com/u/11960635?v=4","gravatar_id":"","url":"https://api.github.com/users/toomasv","html_url":"https://github.com/toomasv","followers_url":"https://api.github.com/users/toomasv/followers","following_url":"https://api.github.com/users/toomasv/following{/other_user}","gists_url":"https://api.github.com/users/toomasv/gists{/gist_id}","starred_url":"https://api.github.com/users/toomasv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toomasv/subscriptions","organizations_url":"https://api.github.com/users/toomasv/orgs","repos_url":"https://api.github.com/users/toomasv/repos","events_url":"https://api.github.com/users/toomasv/events{/privacy}","received_events_url":"https://api.github.com/users/toomasv/received_events","type":"User","site_admin":false},"body":"1) To prevent `underline` or `strike` to be positioned immediately before color-tuple, let's transfer color-setting before other styles in `pop-all`.\r\n```\r\n    pop-all: function [mark [block!]][\r\n        first?: yes \r\n        if col [pop-color] ; <-- TO HERE\r\n        while [mark <> tail stack][\r\n            pop last stack\r\n            either first? [first?: no][remove skip tail out -2]\r\n        ]\r\n        ;if v [pop-color] FROM HERE --^\r\n    ]\r\n```\r\n2) Notice that `v` is changed to `col` above. That's because `v` is set to `none` on each style in path (line 46 below) and so color was not added if it appeared in earlier places in path. To fix it I introduced new flag `col`, which is set to `none` just once while entering path (line 45), and to `yes` if color is seen in the styles path (line 48).\r\n```\r\n        | ahead path!\r\n          into [\r\n            (col: none mark: tail stack) some [ ; <-- LINE 45\r\n                (v: none) ; <-- LINE 46\r\n                s: ['b | 'i | 'u | 's | word! if (tuple? attempt [v: get s/1])]\r\n                (either v [col: yes push-color v][push s/1]) ; <-- LINE 48\r\n            ]\r\n          ]\r\n          nested (pop-all mark)\r\n```\r\n3) `optimize` func, which is meant to join styles with same indexes, actually worked on first one only and ignored further cases because of miscalculated jump on line 117. My proposal is to replace `next` there with `skip`:\r\n```\r\n; e: next move/part s pos offset? s back e ; CURRENT\r\ne: skip move/part s pos l: offset? s back e l ; PROPOSED\r\n```\r\nIn my experiments this works well.\r\n\r\n4) A readability problem -- while popping colors `new-line` was not set. I propose to insert one on line 64:\r\n```\r\n    pop-color: has [entry pos][\r\n        entry: skip tail color-stk -3\r\n        repend out [as-pair entry/1 tail-idx? - entry/1 entry/3]\r\n        new-line skip tail out -2 on ; <-- HERE\r\n        clear entry\r\n    ]\r\n```\r\n\r\nThese fixes correct the second problem mentioned in Gitter post (bugs room 30.12.18) and circumvent the first one without removing the root cause, which is above my head. If ever `strike` or `underline` will appear immediately before color-tuple in data, color is not rendered, e.g. after introducing above fixes, the bug will still affect cases like this:\r\n```\r\nview [rich-text data [s [red \"bbb\"]]]\r\n;But not this\r\nview [rich-text data [s [red [\"bbb\"]]]]\r\n```\r\nThat's because in first case color is closed in the end of processing only, and is then united to `strike` in optimization phase, but on second case color is closed immediately, and `strike` is united to it.","created_at":"2018-12-30T17:08:56Z","updated_at":"2018-12-31T23:47:04Z","closed_at":"2018-12-31T23:47:04Z","merged_at":"2018-12-31T23:47:04Z","merge_commit_sha":"7683030be4dbfafda2fd67757c67e9fb1c099db0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/red/red/pulls/3690/commits","review_comments_url":"https://api.github.com/repos/red/red/pulls/3690/comments","review_comment_url":"https://api.github.com/repos/red/red/pulls/comments{/number}","comments_url":"https://api.github.com/repos/red/red/issues/3690/comments","statuses_url":"https://api.github.com/repos/red/red/statuses/1e1885119564a59b182d27c313b64263c8b6b814","head":{"label":"toomasv:master","ref":"master","sha":"1e1885119564a59b182d27c313b64263c8b6b814","user":{"login":"toomasv","id":11960635,"node_id":"MDQ6VXNlcjExOTYwNjM1","avatar_url":"https://avatars3.githubusercontent.com/u/11960635?v=4","gravatar_id":"","url":"https://api.github.com/users/toomasv","html_url":"https://github.com/toomasv","followers_url":"https://api.github.com/users/toomasv/followers","following_url":"https://api.github.com/users/toomasv/following{/other_user}","gists_url":"https://api.github.com/users/toomasv/gists{/gist_id}","starred_url":"https://api.github.com/users/toomasv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toomasv/subscriptions","organizations_url":"https://api.github.com/users/toomasv/orgs","repos_url":"https://api.github.com/users/toomasv/repos","events_url":"https://api.github.com/users/toomasv/events{/privacy}","received_events_url":"https://api.github.com/users/toomasv/received_events","type":"User","site_admin":false},"repo":{"id":163601108,"node_id":"MDEwOlJlcG9zaXRvcnkxNjM2MDExMDg=","name":"red","full_name":"toomasv/red","private":false,"owner":{"login":"toomasv","id":11960635,"node_id":"MDQ6VXNlcjExOTYwNjM1","avatar_url":"https://avatars3.githubusercontent.com/u/11960635?v=4","gravatar_id":"","url":"https://api.github.com/users/toomasv","html_url":"https://github.com/toomasv","followers_url":"https://api.github.com/users/toomasv/followers","following_url":"https://api.github.com/users/toomasv/following{/other_user}","gists_url":"https://api.github.com/users/toomasv/gists{/gist_id}","starred_url":"https://api.github.com/users/toomasv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toomasv/subscriptions","organizations_url":"https://api.github.com/users/toomasv/orgs","repos_url":"https://api.github.com/users/toomasv/repos","events_url":"https://api.github.com/users/toomasv/events{/privacy}","received_events_url":"https://api.github.com/users/toomasv/received_events","type":"User","site_admin":false},"html_url":"https://github.com/toomasv/red","description":"Red is a next-generation programming language strongly inspired by Rebol, but with a broader field of usage thanks to its native-code compiler, from system programming to high-level scripting and cross-platform reactive GUI, while providing modern support for concurrency, all in a zero-install, zero-config, single 1MB file! ","fork":true,"url":"https://api.github.com/repos/toomasv/red","forks_url":"https://api.github.com/repos/toomasv/red/forks","keys_url":"https://api.github.com/repos/toomasv/red/keys{/key_id}","collaborators_url":"https://api.github.com/repos/toomasv/red/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/toomasv/red/teams","hooks_url":"https://api.github.com/repos/toomasv/red/hooks","issue_events_url":"https://api.github.com/repos/toomasv/red/issues/events{/number}","events_url":"https://api.github.com/repos/toomasv/red/events","assignees_url":"https://api.github.com/repos/toomasv/red/assignees{/user}","branches_url":"https://api.github.com/repos/toomasv/red/branches{/branch}","tags_url":"https://api.github.com/repos/toomasv/red/tags","blobs_url":"https://api.github.com/repos/toomasv/red/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/toomasv/red/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/toomasv/red/git/refs{/sha}","trees_url":"https://api.github.com/repos/toomasv/red/git/trees{/sha}","statuses_url":"https://api.github.com/repos/toomasv/red/statuses/{sha}","languages_url":"https://api.github.com/repos/toomasv/red/languages","stargazers_url":"https://api.github.com/repos/toomasv/red/stargazers","contributors_url":"https://api.github.com/repos/toomasv/red/contributors","subscribers_url":"https://api.github.com/repos/toomasv/red/subscribers","subscription_url":"https://api.github.com/repos/toomasv/red/subscription","commits_url":"https://api.github.com/repos/toomasv/red/commits{/sha}","git_commits_url":"https://api.github.com/repos/toomasv/red/git/commits{/sha}","comments_url":"https://api.github.com/repos/toomasv/red/comments{/number}","issue_comment_url":"https://api.github.com/repos/toomasv/red/issues/comments{/number}","contents_url":"https://api.github.com/repos/toomasv/red/contents/{+path}","compare_url":"https://api.github.com/repos/toomasv/red/compare/{base}...{head}","merges_url":"https://api.github.com/repos/toomasv/red/merges","archive_url":"https://api.github.com/repos/toomasv/red/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/toomasv/red/downloads","issues_url":"https://api.github.com/repos/toomasv/red/issues{/number}","pulls_url":"https://api.github.com/repos/toomasv/red/pulls{/number}","milestones_url":"https://api.github.com/repos/toomasv/red/milestones{/number}","notifications_url":"https://api.github.com/repos/toomasv/red/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/toomasv/red/labels{/name}","releases_url":"https://api.github.com/repos/toomasv/red/releases{/id}","deployments_url":"https://api.github.com/repos/toomasv/red/deployments","created_at":"2018-12-30T16:23:45Z","updated_at":"2018-12-30T16:36:37Z","pushed_at":"2018-12-30T16:36:36Z","git_url":"git://github.com/toomasv/red.git","ssh_url":"git@github.com:toomasv/red.git","clone_url":"https://github.com/toomasv/red.git","svn_url":"https://github.com/toomasv/red","homepage":"http://red-lang.org","size":24621,"stargazers_count":0,"watchers_count":0,"language":"Red","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"red:master","ref":"master","sha":"6968dad018a1612a3ad46c12650633df2a7734fe","user":{"login":"red","id":4625645,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MjU2NDU=","avatar_url":"https://avatars0.githubusercontent.com/u/4625645?v=4","gravatar_id":"","url":"https://api.github.com/users/red","html_url":"https://github.com/red","followers_url":"https://api.github.com/users/red/followers","following_url":"https://api.github.com/users/red/following{/other_user}","gists_url":"https://api.github.com/users/red/gists{/gist_id}","starred_url":"https://api.github.com/users/red/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/red/subscriptions","organizations_url":"https://api.github.com/users/red/orgs","repos_url":"https://api.github.com/users/red/repos","events_url":"https://api.github.com/users/red/events{/privacy}","received_events_url":"https://api.github.com/users/red/received_events","type":"Organization","site_admin":false},"repo":{"id":1449773,"node_id":"MDEwOlJlcG9zaXRvcnkxNDQ5Nzcz","name":"red","full_name":"red/red","private":false,"owner":{"login":"red","id":4625645,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ2MjU2NDU=","avatar_url":"https://avatars0.githubusercontent.com/u/4625645?v=4","gravatar_id":"","url":"https://api.github.com/users/red","html_url":"https://github.com/red","followers_url":"https://api.github.com/users/red/followers","following_url":"https://api.github.com/users/red/following{/other_user}","gists_url":"https://api.github.com/users/red/gists{/gist_id}","starred_url":"https://api.github.com/users/red/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/red/subscriptions","organizations_url":"https://api.github.com/users/red/orgs","repos_url":"https://api.github.com/users/red/repos","events_url":"https://api.github.com/users/red/events{/privacy}","received_events_url":"https://api.github.com/users/red/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/red/red","description":"Red is a next-generation programming language strongly inspired by Rebol, but with a broader field of usage thanks to its native-code compiler, from system programming to high-level scripting and cross-platform reactive GUI, while providing modern support for concurrency, all in a zero-install, zero-config, single 1MB file! ","fork":false,"url":"https://api.github.com/repos/red/red","forks_url":"https://api.github.com/repos/red/red/forks","keys_url":"https://api.github.com/repos/red/red/keys{/key_id}","collaborators_url":"https://api.github.com/repos/red/red/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/red/red/teams","hooks_url":"https://api.github.com/repos/red/red/hooks","issue_events_url":"https://api.github.com/repos/red/red/issues/events{/number}","events_url":"https://api.github.com/repos/red/red/events","assignees_url":"https://api.github.com/repos/red/red/assignees{/user}","branches_url":"https://api.github.com/repos/red/red/branches{/branch}","tags_url":"https://api.github.com/repos/red/red/tags","blobs_url":"https://api.github.com/repos/red/red/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/red/red/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/red/red/git/refs{/sha}","trees_url":"https://api.github.com/repos/red/red/git/trees{/sha}","statuses_url":"https://api.github.com/repos/red/red/statuses/{sha}","languages_url":"https://api.github.com/repos/red/red/languages","stargazers_url":"https://api.github.com/repos/red/red/stargazers","contributors_url":"https://api.github.com/repos/red/red/contributors","subscribers_url":"https://api.github.com/repos/red/red/subscribers","subscription_url":"https://api.github.com/repos/red/red/subscription","commits_url":"https://api.github.com/repos/red/red/commits{/sha}","git_commits_url":"https://api.github.com/repos/red/red/git/commits{/sha}","comments_url":"https://api.github.com/repos/red/red/comments{/number}","issue_comment_url":"https://api.github.com/repos/red/red/issues/comments{/number}","contents_url":"https://api.github.com/repos/red/red/contents/{+path}","compare_url":"https://api.github.com/repos/red/red/compare/{base}...{head}","merges_url":"https://api.github.com/repos/red/red/merges","archive_url":"https://api.github.com/repos/red/red/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/red/red/downloads","issues_url":"https://api.github.com/repos/red/red/issues{/number}","pulls_url":"https://api.github.com/repos/red/red/pulls{/number}","milestones_url":"https://api.github.com/repos/red/red/milestones{/number}","notifications_url":"https://api.github.com/repos/red/red/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/red/red/labels{/name}","releases_url":"https://api.github.com/repos/red/red/releases{/id}","deployments_url":"https://api.github.com/repos/red/red/deployments","created_at":"2011-03-07T11:38:19Z","updated_at":"2018-12-30T16:04:52Z","pushed_at":"2018-12-31T23:47:04Z","git_url":"git://github.com/red/red.git","ssh_url":"git@github.com:red/red.git","clone_url":"https://github.com/red/red.git","svn_url":"https://github.com/red/red","homepage":"http://red-lang.org","size":24616,"stargazers_count":3553,"watchers_count":3553,"language":"Red","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":348,"mirror_url":null,"archived":false,"open_issues_count":393,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":348,"open_issues":393,"watchers":3553,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/red/red/pulls/3690"},"html":{"href":"https://github.com/red/red/pull/3690"},"issue":{"href":"https://api.github.com/repos/red/red/issues/3690"},"comments":{"href":"https://api.github.com/repos/red/red/issues/3690/comments"},"review_comments":{"href":"https://api.github.com/repos/red/red/pulls/3690/comments"},"review_comment":{"href":"https://api.github.com/repos/red/red/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/red/red/pulls/3690/commits"},"statuses":{"href":"https://api.github.com/repos/red/red/statuses/1e1885119564a59b182d27c313b64263c8b6b814"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"greggirwin","id":460079,"node_id":"MDQ6VXNlcjQ2MDA3OQ==","avatar_url":"https://avatars2.githubusercontent.com/u/460079?v=4","gravatar_id":"","url":"https://api.github.com/users/greggirwin","html_url":"https://github.com/greggirwin","followers_url":"https://api.github.com/users/greggirwin/followers","following_url":"https://api.github.com/users/greggirwin/following{/other_user}","gists_url":"https://api.github.com/users/greggirwin/gists{/gist_id}","starred_url":"https://api.github.com/users/greggirwin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greggirwin/subscriptions","organizations_url":"https://api.github.com/users/greggirwin/orgs","repos_url":"https://api.github.com/users/greggirwin/repos","events_url":"https://api.github.com/users/greggirwin/events{/privacy}","received_events_url":"https://api.github.com/users/greggirwin/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":2,"additions":6,"deletions":5,"changed_files":1}}
{"actor":{"display_login":"greggirwin"}}