[vim/vim] Extra line break visible after indent when settings `wrap`, `linebreak` and `breakindent` are enabled (Issue #13228)

20 views
Skip to first unread message

EtiamNullam

unread,
Sep 30, 2023, 7:57:26 AM9/30/23
to vim/vim, Subscribed

Steps to reproduce

vim -u NONE
:set wrap linebreak breakindent
ia<Esc>
1000.
V>

It looks like this (screenshot comes from neovim, but behavior is the same):

image

As you can see text starts in the second line, but it might as well start in the first one.

Expected behaviour

There should be no line break between whitespaces and the text and it should look just like linebreak is disabled in this case.

It should look like this:

image

Version of Vim

9.0

Environment

Operating system: Windows 10
Terminal: cmder 1.3.21
Shell: cmd, powershell

Logs and stack traces

N/A


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13228@github.com>

Christian Brabandt

unread,
Sep 30, 2023, 3:28:09 PM9/30/23
to vim/vim, Subscribed

Well, the linebreak setting tells Vim to break at the white space. And there is no whitespace once the as start.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13228/1741842567@github.com>

EtiamNullam

unread,
Sep 30, 2023, 7:17:50 PM9/30/23
to vim/vim, Subscribed

I'm sorry if I didn't describe the problem well.

I understand that a long word without whitespaces or breakat characters will have to fallback to just wrapping anywhere but that's not the point.

The problem is that a virtual line break appears between a sequence of whitespaces characters and text, even if it won't give any extra space to the text due to breakindent.

Consider this example, where I've set list and listchars to display spaces as +:

image

Cursor is positioned at the last whitespace that precede the long text. The long text begins one column to the right and one row down (which is just one character to the right). It could simply start in the same row. Wrapping in this case is unnecessary.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13228/1741879701@github.com>

Christian Brabandt

unread,
Oct 1, 2023, 3:02:01 AM10/1/23
to vim/vim, Subscribed

I understand what you are pointing out, but you are seeing correct behaviour. In short what linebreak option does is, it sees some whitespace. Vim then checks, if the next consequitive list of characters (that are not in breakat, so lets just call them letters for now) fits into the rest of the screen line. If it does, those letters will be printed on the line and on the next whitespace or breakat characters, it will perform the check again.

In your case, the rest of following letters does not fit into the rest of the screen line, so it needs to wrap at the space right now. And that's what Vim does. So if you don't want that behaviour, then do not set the linebreak option in the first place.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13228/1741983669@github.com>

Christian Brabandt

unread,
Oct 11, 2023, 3:55:13 PM10/11/23
to vim/vim, Subscribed

Closed #13228 as completed via dd75fcf.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/13228/issue_event/10623464725@github.com>

Reply all
Reply to author
Forward
0 new messages