-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support options to treat ambiguous width characters as double width #1453
Comments
Would need the codepoints of that line to track down the unicode segment they belong to. There are several ambiguous width codepoint segments, not sure which need to be customizable. In general it is a good idea to offer this since it might solve some asian glyph alignments (see http://unicode.org/reports/tr11/#Ambiguous). At the moment |
Codepoints for these icons Nerd Fonts: Left Half Circle: The issue occurs regardless of the exact icon, though. Looking at the hundreds codepoints for Nerd Fonts (which include Powerline codepoints), all of them seem to be |
@j0hnm4r5 The current
@Tyriar |
Well there's this section which checks if the character will physically overlap and the next char is a space (32) it will be 2 wide. xterm.js/src/renderer/TextRenderLayer.ts Lines 82 to 100 in 0ad1080
|
@jerch, it happens in both VSCode and Hyper, but not in iTerm. I’m on macOS 10.13. I have not done anything with wcwidth; should I? I’m using Hurmit Nerd Font |
@Tyriar @j0hnm4r5 |
We can get more readable output by running the xterm.js demo, opening devtools console and running |
|
@j0hnm4r5 Oh weird, your left side looks normal. (in hyper, the web thingy seems broken. Missing font maybe?) |
Just to make sure - can you temporarily comment out the snippet Tyriar posted and rerun it? (If you cannot edit it you can step debug it in developer tab and alter the stack values) Edit: Or even simpler - place a breakpoint at |
Can you do the breakpoint thing in hyper instead? Btw your posted escape sequences above look good, there is no additional space, so it does not come from the shell. |
What do you mean by the breakpoint thing in Hyper? |
Sorry that I cant help you better, but as long as I cant repro the issue I cant do it myself. With breakpoint I mean:
Now if the prompt shows up normally, the window is not halted by the breakpoint (you can check by simply pressing some keys, if they show up the terminal still runs). If it got halted, then the overlapping code got executed. |
Hey, I'm learning a ton! And I really appreciate you helping me out. It is definitely getting caught at that breakpoint, and running each character displayed in the entire terminal through that function every update. It's different code than what @Tyriar posted: TextRenderLayer.prototype._isOverlapping = function(e) {
if (1 !== e[o.CHAR_DATA_WIDTH_INDEX])
return !1;
var t = e[o.CHAR_DATA_CODE_INDEX];
if (256 > t)
return !1;
var n = e[o.CHAR_DATA_CHAR_INDEX];
if (this._characterOverlapCache.hasOwnProperty(n))
return this._characterOverlapCache[n];
this._ctx.save(),
this._ctx.font = this._characterFont;
var r = Math.floor(this._ctx.measureText(n).width) > this._characterWidth;
return this._ctx.restore(),
this._characterOverlapCache[n] = r,
r
} I put breakpoints at all three of those return statements, and (I'm not sure if this is helpful at all), but here's where it's stopping at each character, as it goes through "MARS-Deeplocal" and the IP address. |
Thx for getting this running. Yes it looks like the overlapping is triggering it. @Tyriar Any suggestions on how to fix this? (Edit: Prolly fixed already) Edit: |
Hmm. Well one important difference with Hyper and the demo is that Hyper is running on the dynamic char atlas. If you add Line 113 in 099c7d8
If it still works after that change I would wait on Hyper to pick up v3.4 that we released yesterday and maybe jump on the Canary build if you're not already so you get it faster. vercel/hyper#3032 |
@j0hnm4r5 tomorrow's VS Code Insiders build will have almost what's on xterm.js' master branch. It just lacks the new parser PR which I don't think would impact your issue. |
iTerm has a workaround for some powerline issues here https://github.com/bhilburn/powerlevel9k/wiki/Troubleshooting#strange-character--segment-spacing
VS Code got a report for this at microsoft/vscode#48775 (comment)
/cc @jerch
The text was updated successfully, but these errors were encountered: