On Mo, 22 Sep 2014, Christian Brabandt wrote:

> On Fr, 19 Sep 2014, Christian Brabandt wrote:
> 
> > On Fr, 19 Sep 2014, Bram Moolenaar wrote:
> > 
> > > 
> > > Nazri Ramliy wrote:
> > > 
> > > > Attached is a patch that adds a failing test that should show the
> > > > buggy behavior on the following text:
> > > > 
> > > > -- 8< --
> > > > +REMOVE: This text must not be deleted
> > > > +REMOVE: aaaaaaa...repeat until linebreak kicks in...aaaaaaaaaaa....
> > > > +-- >8 --
> > > > 
> > > > With linebreak set and doing a character-wise visual selection on both
> > > > the "REMOVE: " characters (including the single whitespaces) will
> > > > select more than both of the "REMOVE: " characters.
> > > 
> > > The test writes the ".ok" file, that's not the right way to do this.
> > > 
> > > Christian, did you already look into fixing this?
> > 
> > No, I thought this was just about a missing test. I'll look into it next 
> > week.
> 
> This is ... complicated.
> 
> Here is a visual representation of what happens:
> ,-----------------,
> | 1 BAR: xxxx     |
> | 2 BAR:          |
> |   xxxxxxxxxxxxx |
> `----------------ยด
> (now visually block-select the BAR: (including the following 
> whitespace). You'll notice, that the visual selection extends till the 
> end of the window.
> 
> The problem is, when linebreak is set, win_lbr_chartabsize() will select
> the complete whitespace until the end of the screen line, this is, so 
> that the linebreak feature works and the rest of the text is drawn on 
> the next line (and also moving around works as expected).
> 
> I have no idea how to fix it. I played around in function win_update() 
> where wp->w_old_cursor_lcol is set, but this has obviously problems when 
> moving around with the cursor.

I forgot to mention, that virtual editing does seem to work, except that 
this replaces the single space in the last line by the same amount of 
spaces as the window is wide. This might be a bug there as well.

Perhaps it is easier, to temporarily reset the linebreak option? Here is 
a patch, that does this and also prevents that the screen will be 
highlighted incorrectly (and includes a slightly modified test case from 
Nazri).

BTW: The patch also fixes an error for the test_listlbr patch, that 
prevents it from being actually being executed (rather it will simply 
copy the ok file), because the
exists("+conceal")
should actually be a
has("conceal")

(Oh man, I wondered quite a while, why the test would always pass...)

Best,
Christian
-- 
Stoffartige Hilfe, die sich die Poesie der letzten Zeit gibt 
durch bedeutende Motive, Religion und Ritterwesen.
                -- Goethe, Maximen und Reflektionen, Nr. 1310

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/normal.c b/src/normal.c
--- a/src/normal.c
+++ b/src/normal.c
@@ -1380,6 +1380,11 @@ do_pending_operator(cap, old_col, gui_ya
     pos_T	old_cursor;
     int		empty_region_error;
     int		restart_edit_save;
+#ifdef FEAT_LINEBREAK
+    int lbr_saved = curwin->w_p_lbr;
+
+    curwin->w_p_lbr = FALSE;  /* avoid a problem with unwanted linebreaks in block mode */
+#endif
 
     /* The visual area is remembered for redo */
     static int	    redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */
@@ -2136,6 +2141,10 @@ do_pending_operator(cap, old_col, gui_ya
 	oap->block_mode = FALSE;
 	clearop(oap);
     }
+#ifdef FEAT_LINEBREAK
+    if (curwin->w_p_lbr != lbr_saved)
+	curwin->w_p_lbr = lbr_saved;
+#endif
 }
 
 /*
diff --git a/src/screen.c b/src/screen.c
--- a/src/screen.c
+++ b/src/screen.c
@@ -1585,8 +1585,17 @@ win_update(wp)
 	    if (VIsual_mode == Ctrl_V)
 	    {
 		colnr_T	fromc, toc;
-
+#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK)
+		int save_ve = ve_flags;
+
+		if (curwin->w_p_lbr)
+		    ve_flags = VE_ALL;
+#endif
 		getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc);
+#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK)
+		if (ve_flags != save_ve)
+		    ve_flags = save_ve;
+#endif
 		++toc;
 		if (curwin->w_curswant == MAXCOL)
 		    toc = MAXCOL;
diff --git a/src/testdir/test_listlbr.in b/src/testdir/test_listlbr.in
--- a/src/testdir/test_listlbr.in
+++ b/src/testdir/test_listlbr.in
@@ -2,7 +2,7 @@ Test for linebreak and list option (non-
 
 STARTTEST
 :so small.vim
-:if !exists("+linebreak") || !exists("+conceal") | e! test.ok | w! test.out | qa! | endif
+:if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif
 :10new|:vsp|:vert resize 20
 :put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \"
 :norm! zt
@@ -56,6 +56,14 @@ STARTTEST
 :syn match All /.*/ contains=ConcealVar
 :let line=ScreenChar(winwidth(0))
 :call DoRecordScreen()
+:set cpo&vim linebreak
+:let g:test ="Test 6: set linebreak with visual block mode"
+:let line="REMOVE: this not"
+:$put =line
+:let line="REMOVE: aaaaaaaaaaaaa"
+:$put =line
+:1/^REMOVE:
+0jf x:$put
 :%w! test.out
 :qa!
 ENDTEST
diff --git a/src/testdir/test_listlbr.ok b/src/testdir/test_listlbr.ok
--- a/src/testdir/test_listlbr.ok
+++ b/src/testdir/test_listlbr.ok
@@ -32,3 +32,7 @@ Sabbbbbb bla
 ~                   
 ~                   
 ~                   
+this not
+aaaaaaaaaaaaa
+REMOVE: 
+REMOVE: 

Raspunde prin e-mail lui