codepod icon indicating copy to clipboard operation
codepod copied to clipboard

weird line position in code editor

Open forrestbao opened this issue 2 years ago • 1 comments

Sometimes a very long line does not start at where it is supposed at but a line below it. See the screenshot below.

image

In the screenshot above, "t" in "telomeres" should appear right under "n" of "include". The indentation is 4-space.

This happens after using backspace at the beginning of the issue-occurring line.

forrestbao avatar Dec 27 '22 21:12 forrestbao

It seems an old bug in monaco-editor, I also found it in leetcode.com, which also utilizes monaco as its web editor:

image

Update: I see. I searched a little and found it is not a bug, just a feature. The editor option WrappingIndent controls the indent of wrapped words. The default value is None set by Microsoft themselves, which forces all wrapping lines start at the leftmost column. I don't know why they preset like that, Maybe it is a popular feature accepted by most of the users?

Of course, I can set it as Same to make the wrapped lines with the same indent as the first line if you think this is a better feature than None.

li-xin-yi avatar Dec 28 '22 00:12 li-xin-yi