Issue 389 in vim: 'linebreak' breaks c% if the last visual selection was block

71 views
Skip to first unread message

v...@googlecode.com

unread,
Jul 30, 2015, 5:21:51 AM7/30/15
to vim...@vim.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 389 by chris.morganiser: 'linebreak' breaks c% if the last visual
selection was block
https://code.google.com/p/vim/issues/detail?id=389

Précis: when the 'linebreak' option is set and visual block mode was the
last visual mode entered, c% removes the text for deletion in a blockwise
manner rather than the character-wise manner that should be the case.

Detailed steps to reproduce (no special configuration is required;
vim -u NONE exhibits the buggy behaviour):

Enter this demonstrative text:

abcd{ef
ghijklm
no}pqrs

Go to the opening {.

Enter and exit visual block mode (<C-V><C-V>).

At some point no later than this, :set linebreak.

c%<Esc>

The expected contents of the buffer is this:

abcdpqrs

The actual contents of the buffer is this:

abef
ghlm
nors

I haven’t experimented much more, but d% is not buggy.

I am using Vim 7.4.778 on Arch Linux, 64-bit (huge with GTK2 GUI).

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

Axel Bender

unread,
Jul 31, 2015, 5:20:21 AM7/31/15
to vim_dev, vim...@vim.org, codesite...@google.com, v...@googlecode.com
Another sample would be the attached file with (failure on "s"):

<CTRL-v>fbds

Version here: 7.4.803 on Windows 7 (MinGW-64).

bug_vi_linebreak.txt

Arnaud Decara

unread,
Jul 31, 2015, 9:45:23 AM7/31/15
to vim_dev, vim...@vim.org, codesite...@google.com, v...@googlecode.com, axel....@cip-kommunal.de

Hi all,

Please find attached a fix.
(Both issues with the change operator and 's' should
be fixed; undiscovered similar issues that might have
occured should be fixed too.)

Best,
Arnaud

patch-issue-389-linebreak-block-visual.diff

Christian Brabandt

unread,
Jul 31, 2015, 10:03:21 AM7/31/15
to vim...@vim.org
Hi Arnaud!

On Fr, 31 Jul 2015, Arnaud Decara wrote:

> Please find attached a fix.
> (Both issues with the change operator and 's' should
> be fixed; undiscovered similar issues that might have
> occured should be fixed too.)

I believe that breaks test_listlbr.out

Here is a slightly different approach, including a test. The idea is, to
only recalculate the oap->start_vcol and oap->end_vcol columns, if the
cursor is on a wrapped line, else that shouldn't be necessary. However,
I am not completely sure, this is the best solution.

Best,
Christian
--
Der Mensch, der sich vielen Glückes und seiner Schwäche bewußt ist,
wird abergläubisch, flüchtet zum Gebet.
-- Georg Christoph Lichtenberg
(Vermischte Schriften - Beobachtung über den Menschen)
fix_linebreak.diff

Arnaud Decara

unread,
Jul 31, 2015, 10:33:21 AM7/31/15
to vim_dev, vim...@vim.org, cbl...@256bit.org
Hello Christian!
Maybe I'm not using correctly the tests but test_librl does not seem to be
broken here.
(When I run all the tests via the Makefile, i get "Test results : ALL DONE",
and when I remove test_listlbr.out and rerun the test separately I don't get
any error)
Am I doing something wrong?

(But your idea might be better, I'll look at it)

Arnaud

Christian Brabandt

unread,
Jul 31, 2015, 10:37:54 AM7/31/15
to vim_dev, vim...@vim.org
Hi Arnaud!

On Fr, 31 Jul 2015, Arnaud Decara wrote:

> Hello Christian!
>
> On Friday, 31 July 2015 16:03:21 UTC+2, Christian Brabandt wrote:
> > Hi Arnaud!
> >
> > On Fr, 31 Jul 2015, Arnaud Decara wrote:
> >
> > > Please find attached a fix.
> > > (Both issues with the change operator and 's' should
> > > be fixed; undiscovered similar issues that might have
> > > occured should be fixed too.)
> >
> > I believe that breaks test_listlbr.out
> >
> > Here is a slightly different approach, including a test. The idea is, to
> > only recalculate the oap->start_vcol and oap->end_vcol columns, if the
> > cursor is on a wrapped line, else that shouldn't be necessary. However,
> > I am not completely sure, this is the best solution.
> >
> Maybe I'm not using correctly the tests but test_librl does not seem
> to be broken here. (When I run all the tests via the Makefile, i get
> "Test results : ALL DONE", and when I remove test_listlbr.out and
> rerun the test separately I don't get any error)
> Am I doing something wrong?

That should be okay. I am just wondering, because for me that test
failed (which was my first idea when I saw that problem).

Perhaps this was a problem just for me, so in that case your patch would
be preferable for its simplicity. The test should be included
nevertheless ;)

Best,
Christian
--
Mathematiker-Glücksrad: "Ich kaufe ein Epsilon."

Axel Bender

unread,
Aug 5, 2015, 4:54:32 AM8/5/15
to vim_dev, vim...@vim.org, codesite...@google.com, v...@googlecode.com
Will this get fixed, or did I miss something?

Not ok here with 7.4.811.

This is not a push, just a question :()

Christian Brabandt

unread,
Aug 5, 2015, 5:08:30 AM8/5/15
to vim...@googlegroups.com
Was not yet commited. I am sure, Bram will push a fix soon.


Best,Christian

v...@googlecode.com

unread,
Aug 11, 2015, 12:48:17 PM8/11/15
to vim...@vim.org
Updates:
Status: Fixed

Comment #1 on issue 389 by brammool...@gmail.com: 'linebreak' breaks c% if
the last visual selection was block
https://code.google.com/p/vim/issues/detail?id=389

Fix included in patch 7.4.818
Reply all
Reply to author
Forward
0 new messages