On Sunday, June 3, 2012 10:51:27 PM UTC+2, glts wrote:
> Hello list
>
> The "|" command behaves strangely when used with ":normal", 'virtualedit'
> set to "all", and tab characters present. This is in Vim 7.3. Demo:
>
> Some test text (2 lines):
>
> <-- a tab char
> hello more text
>
> Set 'virtualedit' to "all". Press the following keys in normal mode to see
> expected behaviour (cursor is on the first line).
>
> 6|^Vj8|
>
> A Visual block (the whitespace between the two text columns) is selected.
>
> Now do the same from the command line:
>
> :normal 6|^Vj8|
>
> The "6|" part is ignored and instead the current cursor column is used as the
> starting point for the Visual selection. This means that the result is
> different from the one in "real" normal mode, and is effectively dependent on
> the cursor position.
>
> I apologize if this has been brought up before or is invalid. Is this a bug
> and
> has it been resolved?
>
> Thank you!
Hello list
Here's a fix.
*** normal.c 2012-08-12 11:59:25.216786647 +0200
--- normal.c.mod 2012-08-12 12:07:22.216779090 +0200
***************
*** 7786,7792 ****
--- 7786,7795 ----
* virtualedit. Recalculate curwin->w_cursor to avoid bad hilighting.
*/
if (c == Ctrl_V && (ve_flags & VE_BLOCK) && gchar_cursor() == TAB)
+ {
+ validate_virtcol();
coladvance(curwin->w_virtcol);
+ }
#endif
VIsual = curwin->w_cursor;
Root cause: validate_cursor() is never called in between "|" and "^V".
":normal" executes normal commands in a loop which uses update_topline_cursor()
to update the cursor. The pipe command does not call validate_cursor() by
itself nor does it set w_set_curswant to TRUE. Thus it manages to get through
update_topline_cursor() and arrive at nv_start_visual_mode() without ever
having adjusted curwin->w_virtcol.
The patch fixes this. Or perhaps it would be better to fix it inside nv_pipe()?
Anyway, here it is.
Thank you.
David Bürgin
--
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