{"action":"created","issue":{"url":"https://api.github.com/repos/zeit/hyper/issues/740","repository_url":"https://api.github.com/repos/zeit/hyper","labels_url":"https://api.github.com/repos/zeit/hyper/issues/740/labels{/name}","comments_url":"https://api.github.com/repos/zeit/hyper/issues/740/comments","events_url":"https://api.github.com/repos/zeit/hyper/issues/740/events","html_url":"https://github.com/zeit/hyper/pull/740","id":178972114,"number":740,"title":"Unicode Support / Cursor issues Fix","user":{"login":"BenoitAverty","id":17006335,"avatar_url":"https://avatars.githubusercontent.com/u/17006335?v=3","gravatar_id":"","url":"https://api.github.com/users/BenoitAverty","html_url":"https://github.com/BenoitAverty","followers_url":"https://api.github.com/users/BenoitAverty/followers","following_url":"https://api.github.com/users/BenoitAverty/following{/other_user}","gists_url":"https://api.github.com/users/BenoitAverty/gists{/gist_id}","starred_url":"https://api.github.com/users/BenoitAverty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenoitAverty/subscriptions","organizations_url":"https://api.github.com/users/BenoitAverty/orgs","repos_url":"https://api.github.com/users/BenoitAverty/repos","events_url":"https://api.github.com/users/BenoitAverty/events{/privacy}","received_events_url":"https://api.github.com/users/BenoitAverty/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2016-09-23T20:58:47Z","updated_at":"2016-11-17T21:00:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zeit/hyper/pulls/740","html_url":"https://github.com/zeit/hyper/pull/740","diff_url":"https://github.com/zeit/hyper/pull/740.diff","patch_url":"https://github.com/zeit/hyper/pull/740.patch"},"body":"This is based on the work of @MrRio in his PR #535, so thanks to him for the work, I couldn't have done this without him.\n\nThis PR makes hterm add a `<span>` around every unicode character, even when they have default style. The span has the width of the font, which basically forces it to be a monospace font.\n\nSee this screenshot with vtop : \n![2016-09-23-224938_891x682_escrotum](https://cloud.githubusercontent.com/assets/17006335/18800911/0dfde6dc-81e0-11e6-8a05-5d7e5d38790f.png)\n\nAnd you can see that the cursor is still well positioned, even with my prompt abusing wide characters : \n![2016-09-23-225103_895x682_escrotum](https://cloud.githubusercontent.com/assets/17006335/18800952/3afba520-81e0-11e6-95c2-a49f991fd3d5.png)\n\nThere are still some problems that can't be solved (in my opinion, if anyone has a brilliant idea I'll take it)\n- Font rendering is done using OS libraries. I noticed that on some systems, some monospace fonts (for example SourceCodePro, which I use) are not monospace at all font-sizes. I'll post some screenshots on my debian work laptot on monday. Seems to be fine on ubuntu though. This can only be solved in Electron (even chromium probably).\n- The double-width chars are detected by hterm using wc-width npm library, but it only works on some specific characters (i.e Chinese characters). If there are wider characters that don't use this property (font Awesome glyphs for example), they will overlap with their neighbours, as you can see here: \n  ![2016-09-23-225600_894x683_escrotum](https://cloud.githubusercontent.com/assets/17006335/18801062/ee466ca0-81e0-11e6-8315-3a559a5de303.png)\n\nThis is probably not a problem in prompts because there are spaces around, and there are not wide chars side-by-side all that often. We could theoretically measure each characters before inserting them, but then we'd need to fix hterm's cursor position.\n\nWhat's left to do:\n- [x] @MrRio's todo in the \"matchesContainer\" function\n- [ ] Wait for someone else to test with their own use cases.\n\nAll feedback appreciated !\n"},"comment":{"url":"https://api.github.com/repos/zeit/hyper/issues/comments/261367956","html_url":"https://github.com/zeit/hyper/pull/740#issuecomment-261367956","issue_url":"https://api.github.com/repos/zeit/hyper/issues/740","id":261367956,"user":{"login":"BenoitAverty","id":17006335,"avatar_url":"https://avatars.githubusercontent.com/u/17006335?v=3","gravatar_id":"","url":"https://api.github.com/users/BenoitAverty","html_url":"https://github.com/BenoitAverty","followers_url":"https://api.github.com/users/BenoitAverty/followers","following_url":"https://api.github.com/users/BenoitAverty/following{/other_user}","gists_url":"https://api.github.com/users/BenoitAverty/gists{/gist_id}","starred_url":"https://api.github.com/users/BenoitAverty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenoitAverty/subscriptions","organizations_url":"https://api.github.com/users/BenoitAverty/orgs","repos_url":"https://api.github.com/users/BenoitAverty/repos","events_url":"https://api.github.com/users/BenoitAverty/events{/privacy}","received_events_url":"https://api.github.com/users/BenoitAverty/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T21:00:24Z","updated_at":"2016-11-17T21:00:24Z","body":"After much investigations with @matheuss, here are some more information:\r\n\r\nThe problem with vtop happens because most fonts don't have the braille characters used to draw the graphs. As a result, chromium falls back on the first font it finds with braille, which is often not monospaced (or at least not the same size). Apple Braille on MacOS, DejaVu Sans on linux (DejaVu Sans Mono doesn't have braille unfortunately)\r\n\r\nThis particular problem can be solved by including another font, for example FreeMono which has braille and is monospaced. This can be done without creating any more `spans`, but:\r\n - I'm not sure it's work with any font. Maybe the character width doesn't always match\r\n - It doesn't solve anything regarding emojis, fontawesome glyphs... and as a result it doesn't fix the cursor issues : we'd have to find another way to move the cursor to the right position.\r\n\r\nAnyway, that explains the problem with vtop but doesn't solve the problem with chars that are larger even in a monospaced font."}}
{"actor":{"display_login":"BenoitAverty"}}