You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement word wrapping for non monospace fonts #2654
It's wrapping at the wrong place. I'm assuming the line measurement is happening based on character counts rather than the sum of the character widths? This doesn't work so well for us proportional font coders ;-)
Reacted by Martin Ring, Kevin Yin, Toru Nagashima, HE Shi-Jun, Mike MacCana, rosertech, Zev Spitz, Ron Britvich, Jason Meisel, Jason Bacchetta and 7 more
Indeed, we wrap based on the width of n and on the width of a double width character (think CJK). Then, the wrapping code only differentiates between latin and double width characters.
alexandrudima Realistically speaking, is there any chance of this ever getting looked at? Or is the refactoring that this would incur just not worth the cost?
Shameless evangelism: Proportional font coding is amazing. Can't understand why more people don't do this. Code is far more readable. Can fit 2x the amount of code on the screen at once. Helps you catch typos easier. And makes my code look so beautiful :)
Reacted by HE Shi-Jun, Zev Spitz, Ron Britvich, Jason Meisel, Radhika Morabia, Doug, Nathan and Denis Sokolov
Paul Gordon (@paul-go) I've found that using a proportional font lets me focus on the entire keyword/identifier while reading. A monospace font tends to emphasize the individual letter, This is good for APL, but for any language which uses longer keywords/identifiers -- not so much.
I've specifically found that my horizontal scroll behavior is broken on .vue files. I have word wrap set (and lines are properly wrapping), but on my .vue files, horizontal scrolling is still there. This doesn't appear to be happening on my regular .js files, though.
My file doesn’t have any color decorators. I don’t understand why that’s relevant. I made a ticket because despite having proper word wrapping my files are still super wide and have horizontal scroll. I want to be able to disable the horizontal scroll. The fact that I can scroll entirely past all my text to long blank sections of my lines is annoying.
Zev Spitz (@zspitz) Yes, you are using a non-monospace font and this is a known issue tracked in this issue. Thank you for the screenshot, but really not needed at this point.
alexandrudima Realistically speaking, is there any chance of this ever getting looked at? Or is the refactoring that this would incur just not worth the cost?
Echoing this here. Is this being worked on at all? Any information about where it is on the priority list?
Reacted by Nisim Hurst-Tarrab, Mike MacCana, Jason Meisel and Doug
I don't think it's an issue with non-monospace fonts only. I use operator mono and usually wrapping works. But sometimes, when typing a line that is wrapped while typing, the wrapping breaks.
From that point on the horizontal scrollbar is always visible, and the last characters that are typed in a long line always mess up the scrolling.
you type normally, the line is completely visible and scrolled all the way to the left
-> you extend the current line until it should be wrapped
-> the last 1-2 characters go too far. The editor has to scroll to the right to show them
-> the word finally wraps
-> since the cursor is at the end of the word, it does not have to scroll all the way to the left
-> your editor remains scrolled 1-2 characters to the right.
-> The first 1-2 characters of the document are not visible anymore
This issue is really bothering me, I hope this gets seen
image of the broken scrollbar. Once it breaks you can really scroll way too far
Image where you can see the end result after the steps above. The first chars are hidden.
changed the title [-]Word-wrapping doesn't work properly when a proportional font is used[/-][+]Implement word wrapping for non monospace fonts[/+]on Jan 10, 2020
Alexandru Dima (@alexdima) Yes you are right about the width of characters like U+2018, and that's the point. According to the Unicode® Standard Annex #11 these characters are East Asian Ambiguous, therefore require additional information not contained in the character code to further resolve their width.
But VSCode seems to treat them as simple Narrow characters and give them halfwidth characters' width regardless the font used and therefore the horizontal scrollbar appears in word wrap mode.
To reproduce this issue:
Use a chinese or japanese font as first value of Editor: Font Family in preference which give these Ambiguous character wide width(e.g. Simsun in a Simplified Chinese Windows)
Input some text in VSCode editor like ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
Toggle Word Wrap in VSCode through command or Alt+Z
Copy one or all of these characters ‘’“” and paste to line begin repeatly, and you'll see the horizontal scrollbar appears
Press Alt+Z repeatly and pay attention to the horizontal scrollbar you can see the issue
The point is, these characters ‘’“” in most East Asia context (e.g. chinese) they are always wide width as fullwidth characters, but VSCode can not process them correctly.
This link provides the width info about the characters' EAST ASIAN WIDTH, and can be of some help.
To try out, you can use "editor.wrappingAlgorithm": "dom", but be warned that it is orders of magnitude slower than the default one, "editor.wrappingAlgorithm": "monospace"
Reacted by Bruno Logerfo, Zev Spitz and HE Shi-Jun
Activity
alexdima commentedon Feb 4, 2016
Indeed, we wrap based on the width of
nand on the width of a double width character (think CJK). Then, the wrapping code only differentiates between latin and double width characters.mikemaccana commentedon Apr 19, 2018
Same here. Quick example:
paul-go commentedon Jul 27, 2018
alexandrudima Realistically speaking, is there any chance of this ever getting looked at? Or is the refactoring that this would incur just not worth the cost?
Shameless evangelism: Proportional font coding is amazing. Can't understand why more people don't do this. Code is far more readable. Can fit 2x the amount of code on the screen at once. Helps you catch typos easier. And makes my code look so beautiful :)
zspitz commentedon Aug 1, 2018
Paul Gordon (@paul-go) I've found that using a proportional font lets me focus on the entire keyword/identifier while reading. A monospace font tends to emphasize the individual letter, This is good for APL, but for any language which uses longer keywords/identifiers -- not so much.
matsieftw commentedon Sep 28, 2018
I've specifically found that my horizontal scroll behavior is broken on
.vuefiles. I have word wrap set (and lines are properly wrapping), but on my.vuefiles, horizontal scrolling is still there. This doesn't appear to be happening on my regular.jsfiles, though.alexdima commentedon Oct 8, 2018
Mattie Kenny (@matsieftw) color decorators are not taken into account when computing wrapping points (#32856)
2 remaining items
zspitz commentedon Oct 10, 2018
alexandrudima
This is what I'm seeing when editing Markdown (outlined in red):

AFAICT this has nothing to do with color decorations.
matsieftw commentedon Oct 10, 2018
My file doesn’t have any color decorators. I don’t understand why that’s relevant. I made a ticket because despite having proper word wrapping my files are still super wide and have horizontal scroll. I want to be able to disable the horizontal scroll. The fact that I can scroll entirely past all my text to long blank sections of my lines is annoying.
alexdima commentedon Oct 16, 2018
Zev Spitz (@zspitz) Yes, you are using a non-monospace font and this is a known issue tracked in this issue. Thank you for the screenshot, but really not needed at this point.
Mattie Kenny (@matsieftw) I've reopened your issue #59054. Let's continue investigating your precise unique problem there.
rmorabia commentedon Nov 25, 2018
Echoing this here. Is this being worked on at all? Any information about where it is on the priority list?
jabacchetta commentedon Jan 27, 2019
Not sure if these should be filed separately, but two other related issues that bug me in VSCode:
editor.wordWrapis enabled, but that is not taken into account).yspreen commentedon Jul 21, 2019
I don't think it's an issue with non-monospace fonts only. I use operator mono and usually wrapping works. But sometimes, when typing a line that is wrapped while typing, the wrapping breaks.
From that point on the horizontal scrollbar is always visible, and the last characters that are typed in a long line always mess up the scrolling.
you type normally, the line is completely visible and scrolled all the way to the left
-> you extend the current line until it should be wrapped
-> the last 1-2 characters go too far. The editor has to scroll to the right to show them
-> the word finally wraps
-> since the cursor is at the end of the word, it does not have to scroll all the way to the left
-> your editor remains scrolled 1-2 characters to the right.
-> The first 1-2 characters of the document are not visible anymore
This issue is really bothering me, I hope this gets seen

image of the broken scrollbar. Once it breaks you can really scroll way too far
Image where you can see the end result after the steps above. The first chars are hidden.
[-]Word-wrapping doesn't work properly when a proportional font is used[/-][+]Implement word wrapping for non monospace fonts[/+]qaqz111 commentedon Jan 14, 2020
Comment from #70627.
Alexandru Dima (@alexdima) Yes you are right about the width of characters like
U+2018, and that's the point. According to the Unicode® Standard Annex #11 these characters are East Asian Ambiguous, therefore require additional information not contained in the character code to further resolve their width.But VSCode seems to treat them as simple Narrow characters and give them halfwidth characters' width regardless the font used and therefore the horizontal scrollbar appears in word wrap mode.
To reproduce this issue:
The point is, these characters
‘’“”in most East Asia context (e.g. chinese) they are always wide width as fullwidth characters, but VSCode can not process them correctly.This link provides the width info about the characters' EAST ASIAN WIDTH, and can be of some help.
alexdima commentedon Jan 27, 2020
To try out, you can use
"editor.wrappingAlgorithm": "dom", but be warned that it is orders of magnitude slower than the default one,"editor.wrappingAlgorithm": "monospace"