{"action":"created","comment":{"url":"https://api.github.com/repos/xtermjs/xterm.js/pulls/comments/182623055","pull_request_review_id":113454923,"id":182623055,"diff_hunk":"@@ -150,45 +116,68 @@ export class TextRenderLayer extends BaseRenderLayer {\n           }\n         }\n \n-        // Clear the cell next to this character if it's wide\n-        if (width === 2) {\n-          // this.clearCells(x + 1, y, 1, 1);\n-        }\n-\n-        // Draw background\n-        if (bg < 256) {\n-          this._ctx.save();\n-          this._ctx.fillStyle = (bg === INVERTED_DEFAULT_COLOR ? this._colors.foreground.css : this._colors.ansi[bg].css);\n-          this.fillCells(x, y, width, 1);\n-          this._ctx.restore();\n-        }\n-\n-        this._ctx.save();\n         if (flags & FLAGS.BOLD) {\n-          this._ctx.font = this._getFont(terminal, true);\n           // Convert the FG color to the bold variant\n           if (fg < 8) {\n             fg += 8;\n           }\n         }\n \n-        if (flags & FLAGS.UNDERLINE) {\n-          if (fg === INVERTED_DEFAULT_COLOR) {\n-            this._ctx.fillStyle = this._colors.background.css;\n-          } else if (fg < 256) {\n-            // 256 color support\n-            this._ctx.fillStyle = this._colors.ansi[fg].css;\n-          } else {\n-            this._ctx.fillStyle = this._colors.foreground.css;\n-          }\n-          this.fillBottomLineAtCells(x, y);\n-        }\n+        callback(code, char, width, x, y, fg, bg, flags);\n+      }\n+    }\n+  }\n \n-        this.drawChar(terminal, char, code, width, x, y, fg, bg, !!(flags & FLAGS.BOLD), !!(flags & FLAGS.DIM));\n+  private _drawBackground(terminal: ITerminal, startRow: number, endRow: number): void {","path":"src/renderer/TextRenderLayer.ts","position":147,"original_position":147,"commit_id":"b853aa492914bbaef91a73eeae0c904b621bfd9e","original_commit_id":"b853aa492914bbaef91a73eeae0c904b621bfd9e","user":{"login":"bgw","id":180404,"avatar_url":"https://avatars2.githubusercontent.com/u/180404?v=4","gravatar_id":"","url":"https://api.github.com/users/bgw","html_url":"https://github.com/bgw","followers_url":"https://api.github.com/users/bgw/followers","following_url":"https://api.github.com/users/bgw/following{/other_user}","gists_url":"https://api.github.com/users/bgw/gists{/gist_id}","starred_url":"https://api.github.com/users/bgw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgw/subscriptions","organizations_url":"https://api.github.com/users/bgw/orgs","repos_url":"https://api.github.com/users/bgw/repos","events_url":"https://api.github.com/users/bgw/events{/privacy}","received_events_url":"https://api.github.com/users/bgw/received_events","type":"User","site_admin":false},"body":"My plan is to keep track of the previously drawn background color as a variable scoped to the top-level of `_drawBackground`, and then minimize `fillRect` calls by only using `fillRect` once the background color changes or we've stopped iterating over cells.\r\n\r\nWhile your API looks a little nicer, I don't know how I'd accomplish that optimization with it.","created_at":"2018-04-19T03:03:41Z","updated_at":"2018-04-19T03:03:41Z","html_url":"https://github.com/xtermjs/xterm.js/pull/1393#discussion_r182623055","pull_request_url":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/xtermjs/xterm.js/pulls/comments/182623055"},"html":{"href":"https://github.com/xtermjs/xterm.js/pull/1393#discussion_r182623055"},"pull_request":{"href":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393"}},"in_reply_to_id":182473072},"pull_request":{"url":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393","id":182367932,"html_url":"https://github.com/xtermjs/xterm.js/pull/1393","diff_url":"https://github.com/xtermjs/xterm.js/pull/1393.diff","patch_url":"https://github.com/xtermjs/xterm.js/pull/1393.patch","issue_url":"https://api.github.com/repos/xtermjs/xterm.js/issues/1393","number":1393,"state":"open","locked":false,"title":"Separate foreground & background rendering passes","user":{"login":"bgw","id":180404,"avatar_url":"https://avatars2.githubusercontent.com/u/180404?v=4","gravatar_id":"","url":"https://api.github.com/users/bgw","html_url":"https://github.com/bgw","followers_url":"https://api.github.com/users/bgw/followers","following_url":"https://api.github.com/users/bgw/following{/other_user}","gists_url":"https://api.github.com/users/bgw/gists{/gist_id}","starred_url":"https://api.github.com/users/bgw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgw/subscriptions","organizations_url":"https://api.github.com/users/bgw/orgs","repos_url":"https://api.github.com/users/bgw/repos","events_url":"https://api.github.com/users/bgw/events{/privacy}","received_events_url":"https://api.github.com/users/bgw/received_events","type":"User","site_admin":false},"body":"I'm primarily interested in doing this because it'll allow me to optimize the background rendering in later diffs, but this may also make it possible to fix some minor rendering issues.\r\n\r\nRight now, if we draw a single-width character that overflows its cell's bounds, and the character to the right of it has a background, that background may cover up the first character's foreground. By drawing the background in a separate pass, we can avoid those cases.\r\n\r\nThere's still some issues with how dirty regions are computed that makes rendering stuff like that flaky, but this at least gets us closer to \"correct\" rendering.\r\n\r\nOther terminal emulators (e.g. alacritty) render the foreground and background in separate passes:\r\nhttps://github.com/jwilm/alacritty/blob/1b7ffea/src/renderer/mod.rs#L766","created_at":"2018-04-18T05:00:36Z","updated_at":"2018-04-19T03:03:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"403067105119fefdd1919f7f396609bc7cd3ce2a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393/commits","review_comments_url":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393/comments","review_comment_url":"https://api.github.com/repos/xtermjs/xterm.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/xtermjs/xterm.js/issues/1393/comments","statuses_url":"https://api.github.com/repos/xtermjs/xterm.js/statuses/b853aa492914bbaef91a73eeae0c904b621bfd9e","head":{"label":"bgw:text-render-layer","ref":"text-render-layer","sha":"b853aa492914bbaef91a73eeae0c904b621bfd9e","user":{"login":"bgw","id":180404,"avatar_url":"https://avatars2.githubusercontent.com/u/180404?v=4","gravatar_id":"","url":"https://api.github.com/users/bgw","html_url":"https://github.com/bgw","followers_url":"https://api.github.com/users/bgw/followers","following_url":"https://api.github.com/users/bgw/following{/other_user}","gists_url":"https://api.github.com/users/bgw/gists{/gist_id}","starred_url":"https://api.github.com/users/bgw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgw/subscriptions","organizations_url":"https://api.github.com/users/bgw/orgs","repos_url":"https://api.github.com/users/bgw/repos","events_url":"https://api.github.com/users/bgw/events{/privacy}","received_events_url":"https://api.github.com/users/bgw/received_events","type":"User","site_admin":false},"repo":{"id":122307965,"name":"xterm.js","full_name":"bgw/xterm.js","owner":{"login":"bgw","id":180404,"avatar_url":"https://avatars2.githubusercontent.com/u/180404?v=4","gravatar_id":"","url":"https://api.github.com/users/bgw","html_url":"https://github.com/bgw","followers_url":"https://api.github.com/users/bgw/followers","following_url":"https://api.github.com/users/bgw/following{/other_user}","gists_url":"https://api.github.com/users/bgw/gists{/gist_id}","starred_url":"https://api.github.com/users/bgw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgw/subscriptions","organizations_url":"https://api.github.com/users/bgw/orgs","repos_url":"https://api.github.com/users/bgw/repos","events_url":"https://api.github.com/users/bgw/events{/privacy}","received_events_url":"https://api.github.com/users/bgw/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bgw/xterm.js","description":"Full xterm terminal, in your browser","fork":true,"url":"https://api.github.com/repos/bgw/xterm.js","forks_url":"https://api.github.com/repos/bgw/xterm.js/forks","keys_url":"https://api.github.com/repos/bgw/xterm.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bgw/xterm.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bgw/xterm.js/teams","hooks_url":"https://api.github.com/repos/bgw/xterm.js/hooks","issue_events_url":"https://api.github.com/repos/bgw/xterm.js/issues/events{/number}","events_url":"https://api.github.com/repos/bgw/xterm.js/events","assignees_url":"https://api.github.com/repos/bgw/xterm.js/assignees{/user}","branches_url":"https://api.github.com/repos/bgw/xterm.js/branches{/branch}","tags_url":"https://api.github.com/repos/bgw/xterm.js/tags","blobs_url":"https://api.github.com/repos/bgw/xterm.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bgw/xterm.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bgw/xterm.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/bgw/xterm.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bgw/xterm.js/statuses/{sha}","languages_url":"https://api.github.com/repos/bgw/xterm.js/languages","stargazers_url":"https://api.github.com/repos/bgw/xterm.js/stargazers","contributors_url":"https://api.github.com/repos/bgw/xterm.js/contributors","subscribers_url":"https://api.github.com/repos/bgw/xterm.js/subscribers","subscription_url":"https://api.github.com/repos/bgw/xterm.js/subscription","commits_url":"https://api.github.com/repos/bgw/xterm.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/bgw/xterm.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/bgw/xterm.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/bgw/xterm.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/bgw/xterm.js/contents/{+path}","compare_url":"https://api.github.com/repos/bgw/xterm.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bgw/xterm.js/merges","archive_url":"https://api.github.com/repos/bgw/xterm.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bgw/xterm.js/downloads","issues_url":"https://api.github.com/repos/bgw/xterm.js/issues{/number}","pulls_url":"https://api.github.com/repos/bgw/xterm.js/pulls{/number}","milestones_url":"https://api.github.com/repos/bgw/xterm.js/milestones{/number}","notifications_url":"https://api.github.com/repos/bgw/xterm.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bgw/xterm.js/labels{/name}","releases_url":"https://api.github.com/repos/bgw/xterm.js/releases{/id}","deployments_url":"https://api.github.com/repos/bgw/xterm.js/deployments","created_at":"2018-02-21T08:06:13Z","updated_at":"2018-03-29T02:18:11Z","pushed_at":"2018-04-18T04:58:25Z","git_url":"git://github.com/bgw/xterm.js.git","ssh_url":"git@github.com:bgw/xterm.js.git","clone_url":"https://github.com/bgw/xterm.js.git","svn_url":"https://github.com/bgw/xterm.js","homepage":"https://xtermjs.org/","size":4423,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"xtermjs:master","ref":"master","sha":"cf8fa10205b7c7011b874de4319153079a8bb5b9","user":{"login":"xtermjs","id":11927490,"avatar_url":"https://avatars1.githubusercontent.com/u/11927490?v=4","gravatar_id":"","url":"https://api.github.com/users/xtermjs","html_url":"https://github.com/xtermjs","followers_url":"https://api.github.com/users/xtermjs/followers","following_url":"https://api.github.com/users/xtermjs/following{/other_user}","gists_url":"https://api.github.com/users/xtermjs/gists{/gist_id}","starred_url":"https://api.github.com/users/xtermjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtermjs/subscriptions","organizations_url":"https://api.github.com/users/xtermjs/orgs","repos_url":"https://api.github.com/users/xtermjs/repos","events_url":"https://api.github.com/users/xtermjs/events{/privacy}","received_events_url":"https://api.github.com/users/xtermjs/received_events","type":"Organization","site_admin":false},"repo":{"id":18068542,"name":"xterm.js","full_name":"xtermjs/xterm.js","owner":{"login":"xtermjs","id":11927490,"avatar_url":"https://avatars1.githubusercontent.com/u/11927490?v=4","gravatar_id":"","url":"https://api.github.com/users/xtermjs","html_url":"https://github.com/xtermjs","followers_url":"https://api.github.com/users/xtermjs/followers","following_url":"https://api.github.com/users/xtermjs/following{/other_user}","gists_url":"https://api.github.com/users/xtermjs/gists{/gist_id}","starred_url":"https://api.github.com/users/xtermjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xtermjs/subscriptions","organizations_url":"https://api.github.com/users/xtermjs/orgs","repos_url":"https://api.github.com/users/xtermjs/repos","events_url":"https://api.github.com/users/xtermjs/events{/privacy}","received_events_url":"https://api.github.com/users/xtermjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/xtermjs/xterm.js","description":"Full xterm terminal, in your browser","fork":false,"url":"https://api.github.com/repos/xtermjs/xterm.js","forks_url":"https://api.github.com/repos/xtermjs/xterm.js/forks","keys_url":"https://api.github.com/repos/xtermjs/xterm.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/xtermjs/xterm.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/xtermjs/xterm.js/teams","hooks_url":"https://api.github.com/repos/xtermjs/xterm.js/hooks","issue_events_url":"https://api.github.com/repos/xtermjs/xterm.js/issues/events{/number}","events_url":"https://api.github.com/repos/xtermjs/xterm.js/events","assignees_url":"https://api.github.com/repos/xtermjs/xterm.js/assignees{/user}","branches_url":"https://api.github.com/repos/xtermjs/xterm.js/branches{/branch}","tags_url":"https://api.github.com/repos/xtermjs/xterm.js/tags","blobs_url":"https://api.github.com/repos/xtermjs/xterm.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/xtermjs/xterm.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/xtermjs/xterm.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/xtermjs/xterm.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/xtermjs/xterm.js/statuses/{sha}","languages_url":"https://api.github.com/repos/xtermjs/xterm.js/languages","stargazers_url":"https://api.github.com/repos/xtermjs/xterm.js/stargazers","contributors_url":"https://api.github.com/repos/xtermjs/xterm.js/contributors","subscribers_url":"https://api.github.com/repos/xtermjs/xterm.js/subscribers","subscription_url":"https://api.github.com/repos/xtermjs/xterm.js/subscription","commits_url":"https://api.github.com/repos/xtermjs/xterm.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/xtermjs/xterm.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/xtermjs/xterm.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/xtermjs/xterm.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/xtermjs/xterm.js/contents/{+path}","compare_url":"https://api.github.com/repos/xtermjs/xterm.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/xtermjs/xterm.js/merges","archive_url":"https://api.github.com/repos/xtermjs/xterm.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/xtermjs/xterm.js/downloads","issues_url":"https://api.github.com/repos/xtermjs/xterm.js/issues{/number}","pulls_url":"https://api.github.com/repos/xtermjs/xterm.js/pulls{/number}","milestones_url":"https://api.github.com/repos/xtermjs/xterm.js/milestones{/number}","notifications_url":"https://api.github.com/repos/xtermjs/xterm.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/xtermjs/xterm.js/labels{/name}","releases_url":"https://api.github.com/repos/xtermjs/xterm.js/releases{/id}","deployments_url":"https://api.github.com/repos/xtermjs/xterm.js/deployments","created_at":"2014-03-24T16:04:04Z","updated_at":"2018-04-19T02:43:14Z","pushed_at":"2018-04-18T15:10:22Z","git_url":"git://github.com/xtermjs/xterm.js.git","ssh_url":"git@github.com:xtermjs/xterm.js.git","clone_url":"https://github.com/xtermjs/xterm.js.git","svn_url":"https://github.com/xtermjs/xterm.js","homepage":"https://xtermjs.org/","size":4419,"stargazers_count":3540,"watchers_count":3540,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":381,"mirror_url":null,"archived":false,"open_issues_count":163,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":381,"open_issues":163,"watchers":3540,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393"},"html":{"href":"https://github.com/xtermjs/xterm.js/pull/1393"},"issue":{"href":"https://api.github.com/repos/xtermjs/xterm.js/issues/1393"},"comments":{"href":"https://api.github.com/repos/xtermjs/xterm.js/issues/1393/comments"},"review_comments":{"href":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393/comments"},"review_comment":{"href":"https://api.github.com/repos/xtermjs/xterm.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/xtermjs/xterm.js/pulls/1393/commits"},"statuses":{"href":"https://api.github.com/repos/xtermjs/xterm.js/statuses/b853aa492914bbaef91a73eeae0c904b621bfd9e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bgw"}}