Issue 312 in vim: word wrapping messed up when entering Insert mode with 'c' or 's'

89 views
Skip to first unread message

v...@googlecode.com

unread,
Jan 9, 2015, 2:14:22 PM1/9/15
to vim...@vim.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 312 by gilad.ar...@gmail.com: word wrapping messed up when
entering Insert mode with 'c' or 's'
https://code.google.com/p/vim/issues/detail?id=312

What steps will reproduce the problem?
1. set linebreak
2. Fill the line with words until it wraps, make sure that the first
character in the wrapped word could still fit on the previous line.
3. Move to anywhere on (one of) the continuation lines.
4. Press 's' to enter Insert mode.

What is the expected output? What do you see instead?
Expected: line breaking prior to the cursor location does not change; word
wrapping remains legible.
Actual: line breaks before the cursor are recomputed, and do not honor word
boundaries any more.

What version of the product are you using? On what operating system?
Vim 7.4.473 on Ubuntu Linux.
For context, vim 7.4.52 on Mint Linux does not have this problem.

Please provide any additional information below.

* When entering Insert mode the cursor seems to move with the text, i.e.
keep its location relative to the insert point.
* After quitting Insert mode (Esc) the lines of text remain the same, but
the cursor seems to move to the screen location where it would supposedly
have been had the text layout not changed.
* Outside of Insert mode, hitting Ctrl-L would cause the paragraph to
rearrange correctly. The cursor would align with the text that has just
been edited.
* This happens in both Vim and Gvim in the exact same way, so not a
terminal issue.
* Happens regardless of the value of showbreak.
* This may be related to the breakindent feature, which is present in my
buggy version (7.4.473) but not the good version (7.4.52).

Attaching screenshots before clicking 's', after clicking it, after
pressing Esc to quit Insert mode, and after pressing Ctrl-L to rearrange
the paragraph.

Attachments:
Screenshot from 2015-01-09 11:06:13.png 22.1 KB
Screenshot from 2015-01-09 11:06:46.png 21.9 KB
Screenshot from 2015-01-09 11:06:53.png 21.5 KB
Screenshot from 2015-01-09 11:07:01.png 20.8 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

v...@googlecode.com

unread,
Jan 9, 2015, 6:01:40 PM1/9/15
to vim...@vim.org

Comment #1 on issue 312 by dha...@gmail.com: word wrapping messed up when
entering Insert mode with 'c' or 's'
https://code.google.com/p/vim/issues/detail?id=312

> Vim 7.4.473

IIRC correctly there have been fixes in this regard lately.
Can you try the current version / hg tip?

Roland Eggner

unread,
Jan 9, 2015, 10:55:03 PM1/9/15
to vim...@googlegroups.com
This is probably the same issue as has been reported several weeks ago.

Christian Brabandt provided two patches already. Both are on Brams todo list
and not yet included. For your convenience I have attached my versions updated
for 7.4.529. It appears they apply to current tip 7.4.567 cleanly, just for one
hunk I saw an offset message. Please try and report if they fix your issue.

--
Roland Eggner
91 Christian Brabandt <cblists@256bit.org> 2014-11-12 19.58.48 +0100 Fix incorrect display of wrapped lines during insert mode with option linebreak set.patch
92 Christian Brabandt <cblists@256bit.org> 2014-11-26 08.36.17 +0100 Bug with rnu and linebreak.patch

Christian Brabandt

unread,
Jan 10, 2015, 7:08:22 AM1/10/15
to vim...@googlegroups.com
Hi Roland!
We only need the second patch (the one, that is called "Fix bug with
options relativenumbers and linebreak set"), right?


Best,
Christian
--

v...@googlecode.com

unread,
Jan 10, 2015, 7:10:16 AM1/10/15
to vim...@vim.org
Updates:
Labels: patch

Comment #2 on issue 312 by chrisbr...@googlemail.com: word wrapping messed
up when entering Insert mode with 'c' or 's'
https://code.google.com/p/vim/issues/detail?id=312

Please check the patches provided and report back whether they work. Find
the patches here:
https://groups.google.com/d/msg/vim_dev/Bh0Nd321JYE/be9Cfu9DLmcJ
(I think, you only need the second patch, but please test and report back).

Gary Johnson

unread,
Jan 10, 2015, 5:15:16 PM1/10/15
to vim...@googlegroups.com
On 2015-01-10, Christian Brabandt wrote:
> Hi Roland!
>
> On Sa, 10 Jan 2015, Roland Eggner wrote:
>
> > On 2015-01-09 Friday at 19:14 +0000 v...@googlecode.com wrote:
> > > Status: New Owner: ---- Labels: Type-Defect Priority-Medium
> > >
> > > New issue 312 by gilad.ar...@gmail.com: word wrapping messed up when
> > > entering Insert mode with 'c' or 's'
> > > https://code.google.com/p/vim/issues/detail?id=312
> > >
> > > What steps will reproduce the problem? 1. set linebreak 2. Fill the
> > > line with words until it wraps, make sure that the first character
> > > in the wrapped word could still fit on the previous line. 3. Move to
> > > anywhere on (one of) the continuation lines. 4. Press 's' to enter
> > > Insert mode.
> > >
> > > What is the expected output? What do you see instead? Expected: line
> > > breaking prior to the cursor location does not change; word
> > > wrapping remains legible. Actual: line breaks before the cursor are
> > > recomputed, and do not honor word boundaries any more.
> > >
> > > What version of the product are you using? On what operating system?
> > > Vim 7.4.473 on Ubuntu Linux. For context, vim 7.4.52 on Mint Linux
> > > does not have this problem.

> > This is probably the same issue as has been reported several weeks
> > ago.
> >
> > Christian Brabandt provided two patches already. Both are on Brams
> > todo list and not yet included. For your convenience I have attached
> > my versions updated for 7.4.529. It appears they apply to current tip
> > 7.4.567 cleanly, just for one hunk I saw an offset message. Please
> > try and report if they fix your issue.
>
> We only need the second patch (the one, that is called "Fix bug with
> options relativenumbers and linebreak set"), right?

Hi Christian,

I applied what I took to be the second patch at
https://groups.google.com/forum/#!msg/vim_dev/Bh0Nd321JYE/be9Cfu9DLmcJ,
the one dated 2014-11-26 and called "Bug with rnu and
linebreak.patch", to Vim 7.4.567. It does not fix the problem I am
observing, which I think is the same as reported above. That is,
after editing a long line of text with 'linebreak' set, the text is
no longer broken between words but appears as it would
if 'linebreak' was not set.

In my experiment with your patch, I executed this,

vim -N -u NONE -c 'set linebreak' ~/lorem_ipsum.5p

where ~/lorem_ipsum.5p is five paragraphs of lorem ipsum text. The
behavior is the same, though, even with a single line that wraps
only once. When I type s anywhere in a line, all the text in that
line is immediately re-broken at the right screen edge rather than
between words. Typing <Esc> leaves the line in that state. Typing
<Ctrl-L> redraws the screen with the line correctly broken between
words.

I ran the test with vim in a GNOME Terminal on Fedora 14 Linux.

Regards,
Gary

Christian Brabandt

unread,
Jan 11, 2015, 4:40:18 AM1/11/15
to vim...@googlegroups.com
Hi Gary!
Alright, I'll check again. Will post an updated patch later today.

(I have posted too many patches recently and got lost which one actually
worked and has been applied)

Best,
Christian
--
Auspuffgase:
der Weihrauch der Zivilisation.

Christian Brabandt

unread,
Jan 11, 2015, 8:18:26 AM1/11/15
to vim...@googlegroups.com
Can you please check with this patch:
https://github.com/chrisbra/vim-mq-patches/blob/master/linebreak_bug

That should fix all observed problems.

Best,
Christian
--
Treibt's das Hähnchen all zu lange, fällt das Hühnchen von der Stange.

Gary Johnson

unread,
Jan 11, 2015, 2:02:48 PM1/11/15
to vim...@googlegroups.com
In my testing so far, that one works great! Thank you!

I'll apply it to my Vim installations at work, which use Windows as
well as Linux, tomorrow.

Regards,
Gary

v...@googlecode.com

unread,
Jan 14, 2015, 1:41:58 PM1/14/15
to vim...@vim.org
Updates:
Status: Fixed

Comment #3 on issue 312 by chrisbr...@googlemail.com: word wrapping messed
up when entering Insert mode with 'c' or 's'
https://code.google.com/p/vim/issues/detail?id=312

Fixed by 7.4.576
https://code.google.com/p/vim/source/detail?r=749fc929da45d07efc5352dd8a0c00f8ed9f2163
closing

v...@googlecode.com

unread,
Jan 15, 2015, 5:04:02 PM1/15/15
to vim...@vim.org

Comment #4 on issue 312 by gilad.ar...@gmail.com: word wrapping messed up
when entering Insert mode with 'c' or 's'
https://code.google.com/p/vim/issues/detail?id=312

Verified with 7.4.580, problem is gone. Thanks!
Reply all
Reply to author
Forward
0 new messages