Skip to content

Implement word wrapping for non monospace fonts #2654

Closed

Description

@paul-go

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 ;-)

Activity

  1. alexdima commented on Feb 4, 2016

    @alexdima
    Member

    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.

  2. added
    feature-request
    on Feb 4, 2016
  3. added
    editor-wrapping
    and removed
    editor-core
    on Dec 14, 2017
  4. mikemaccana commented on Apr 19, 2018

    @mikemaccana

    Same here. Quick example:

    image

  5. paul-go commented on Jul 27, 2018

    @paul-go
    Author

    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 :)

  6. zspitz commented on Aug 1, 2018

    @zspitz

    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.

  7. matsieftw commented on Sep 28, 2018

    @matsieftw

    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.

  8. alexdima commented on Oct 8, 2018

    @alexdima
    Member

    Mattie Kenny (@matsieftw) color decorators are not taken into account when computing wrapping points (#32856)

  9. 2 remaining items

  10. zspitz commented on Oct 10, 2018

    @zspitz

    alexandrudima

    This is what I'm seeing when editing Markdown (outlined in red):
    image
    AFAICT this has nothing to do with color decorations.

  11. matsieftw commented on Oct 10, 2018

    @matsieftw

    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.

  12. alexdima commented on Oct 16, 2018

    @alexdima
    Member

    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.

  13. rmorabia commented on Nov 25, 2018

    @rmorabia

    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?

  14. jabacchetta commented on Jan 27, 2019

    @jabacchetta

    Not sure if these should be filed separately, but two other related issues that bug me in VSCode:

    • The horizontal scroll bar appears when it's not necessary (i.e. editor.wordWrap is enabled, but that is not taken into account).
    • When removing overflow, the horizontal scroll bar does not get removed until a different editor is focused.
  15. yspreen commented on Jul 21, 2019

    @yspreen

    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
    image of the broken scrollbar. Once it breaks you can really scroll way too far

    image
    Image where you can see the end result after the steps above. The first chars are hidden.

  16. 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
  17. qaqz111 commented on Jan 14, 2020

    @qaqz111

    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.

    Wrap

    To reproduce this issue:

    1. 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)
    2. Input some text in VSCode editor like ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
    3. Toggle Word Wrap in VSCode through command or Alt+Z
    4. Copy one or all of these characters ‘’“” and paste to line begin repeatly, and you'll see the horizontal scrollbar appears
    5. 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.

  18. alexdima commented on Jan 27, 2020

    @alexdima
    Member

    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"

  19. locked and limited conversation to collaborators on Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-wrappingfeature-requeston-testplan

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions