{"action":"created","issue":{"url":"https://api.github.com/repos/atom/atom/issues/6083","labels_url":"https://api.github.com/repos/atom/atom/issues/6083/labels{/name}","comments_url":"https://api.github.com/repos/atom/atom/issues/6083/comments","events_url":"https://api.github.com/repos/atom/atom/issues/6083/events","html_url":"https://github.com/atom/atom/pull/6083","id":64091530,"number":6083,"title":"Char measurement","user":{"login":"as-cii","id":482957,"avatar_url":"https://avatars.githubusercontent.com/u/482957?v=3","gravatar_id":"","url":"https://api.github.com/users/as-cii","html_url":"https://github.com/as-cii","followers_url":"https://api.github.com/users/as-cii/followers","following_url":"https://api.github.com/users/as-cii/following{/other_user}","gists_url":"https://api.github.com/users/as-cii/gists{/gist_id}","starred_url":"https://api.github.com/users/as-cii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/as-cii/subscriptions","organizations_url":"https://api.github.com/users/as-cii/orgs","repos_url":"https://api.github.com/users/as-cii/repos","events_url":"https://api.github.com/users/as-cii/events{/privacy}","received_events_url":"https://api.github.com/users/as-cii/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-03-24T20:26:09Z","updated_at":"2015-03-26T19:55:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/atom/atom/pulls/6083","html_url":"https://github.com/atom/atom/pull/6083","diff_url":"https://github.com/atom/atom/pull/6083.diff","patch_url":"https://github.com/atom/atom/pull/6083.patch"},"body":"Fixes #6055 \r\n\r\nThis is still a work in progress: code is messy and specs are not passing yet. ~~With this PR we basically wrap every character with a span so that we're able to measure it. This helps to calculate the real character's width on screen: whenever this is not possible, however, the current solution falls back to `@defaultCharWidth`.~~\r\n\r\nWe have split the `TextEditorPresenter` and the `TextEditorComponent` updates in two phases: pre-measure and post-measure. The former should calculate anything related to lines, whereas the latter  performs updates which need to be based on lines measurement.\r\n\r\n* [ ] Write new specs to consolidate this behavior\r\n* [x] Make existing specs pass\r\n* [x] Remove references to scoped char width"},"comment":{"url":"https://api.github.com/repos/atom/atom/issues/comments/86689814","html_url":"https://github.com/atom/atom/pull/6083#issuecomment-86689814","issue_url":"https://api.github.com/repos/atom/atom/issues/6083","id":86689814,"user":{"login":"as-cii","id":482957,"avatar_url":"https://avatars.githubusercontent.com/u/482957?v=3","gravatar_id":"","url":"https://api.github.com/users/as-cii","html_url":"https://github.com/as-cii","followers_url":"https://api.github.com/users/as-cii/followers","following_url":"https://api.github.com/users/as-cii/following{/other_user}","gists_url":"https://api.github.com/users/as-cii/gists{/gist_id}","starred_url":"https://api.github.com/users/as-cii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/as-cii/subscriptions","organizations_url":"https://api.github.com/users/as-cii/orgs","repos_url":"https://api.github.com/users/as-cii/repos","events_url":"https://api.github.com/users/as-cii/events{/privacy}","received_events_url":"https://api.github.com/users/as-cii/received_events","type":"User","site_admin":false},"created_at":"2015-03-26T19:55:40Z","updated_at":"2015-03-26T19:55:40Z","body":"> I wonder if the presenter could have some state that maintains what positions we'll actually need to measure and only measure those locations. Something like `screenRangesToMeasure` or something.\r\n\r\nThat's an optimization we could make and I had that in mind too, but quoting what I've written in my previous comment:\r\n\r\n> One way to gain some speed here may be to simply skip already measured lines: however, we need to keep in mind that **sub-pixel rendering may occur** if, for example, a line has changed position, and therefore we need an always fresh char width value.\r\n\r\nSo, basically, even though we have already measured characters' width for a certain line, when scrolling up or down we have no guarantee that such widths are correct because sub-pixel rendering *may* have happened. What do you think?"}}