Skip to content
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

Word Wrap is imprecise with non-monospace fonts #12421

Closed
jmcooper opened this issue Sep 22, 2016 · 11 comments
Closed

Word Wrap is imprecise with non-monospace fonts #12421

jmcooper opened this issue Sep 22, 2016 · 11 comments
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-wrapping Editor line wrapping issues feature-request Request for new features or functionality
Milestone

Comments

@jmcooper
Copy link

I'm seeing a wide right margin in my editor when I have word wrap on.
widemargin
I don't see this on other computers. Not sure what's up. This is all I have in my user settings:
// Place your settings in this file to overwrite the default settings
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.fontSize": 21,
"editor.fontFamily": "Source Code Pro",
"git.enabled": false
}

  • VSCode Version: Code 1.5.2 (66f37fd, 2016-09-12T13:30:03.456Z)
  • OS Version: Windows_NT ia32 10.0.10586

Steps to Reproduce:

  1. Turn on Word Wrap (alt-z)
@alexdima
Copy link
Member

@jmcooper Try changing the setting: editor.wrappingIndent: "none". It is "same" by default

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Sep 22, 2016
@chrmarti chrmarti self-assigned this Sep 22, 2016
@jmcooper
Copy link
Author

@alexandrudima Thanks, but that affects the behavior of the left indent. I've tried changing that and it doesn't help.

@jmcooper
Copy link
Author

@chrmarti Is there some info you need that I can get you?

@chrmarti
Copy link
Collaborator

@jmcooper To clarify: You are referring to the spacing left of the line numbers, right?

@jmcooper
Copy link
Author

jmcooper commented Sep 23, 2016

No, I'm referring to all the white space on right side, after the code. It
is like the code is wrapping way too soon.

@chrmarti
Copy link
Collaborator

We only wrap on whitespace it seems.

@chrmarti chrmarti assigned alexdima and unassigned chrmarti Sep 23, 2016
@chrmarti chrmarti added feature-request Request for new features or functionality and removed info-needed Issue requires more information from poster labels Sep 23, 2016
@jmcooper
Copy link
Author

jmcooper commented Sep 23, 2016

That's not the problem, I already tested that by adding some whitespace and
it still wrapped way early.

@jmcooper
Copy link
Author

jmcooper commented Sep 24, 2016

@chrmarti Notice in this screenshot how line 22 is wrapping. There is plenty of space for the }); and yet it wrapped because of some invisible, wide margin on the right. If I make my window wider it will unwrap, so it does appear to be a wrapping problem.

widemargin2

@alexdima
Copy link
Member

@jmcooper Thank you for the clarifications. Now I understand what you mean.

Word wrapping cut points are computed on our side based on two characters widths, namely the width of n for half-width characters and the width of for CJK full-width characters.

Given your text doesn't contain CJK full-width characters, only the width of n is used. So each character counts as the width of n, including i or j which are quite thin.

TL;DR The computation of wrapping cut points is imprecise for non-monospaced fonts.

@alexdima alexdima changed the title Large right margin with Word Wrap Word Wrap is imprecise with non-monospace fonts Sep 26, 2016
@alexdima alexdima added the editor-core Editor basic functionality label Sep 26, 2016
@alexdima alexdima added this to the Backlog milestone Sep 26, 2016
@alexdima alexdima removed their assignment Sep 26, 2016
@jmcooper
Copy link
Author

Ahh, this makes sense. I didn't realize the font I was trying to use wasn't installed, so I was getting a non-monospaced font.

@alexdima alexdima added editor-wrapping Editor line wrapping issues and removed editor-core Editor basic functionality labels Oct 21, 2019
@alexdima
Copy link
Member

Let's track in #2654

@alexdima alexdima added the *duplicate Issue identified as a duplicate of another issue(s) label Jan 10, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-wrapping Editor line wrapping issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants