jeromejj / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Relative Numbering is Incorrect After Line-Wise Selection Followed by Yank #235

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. set relative numbering on (:set rnu).
2. use 'V' (uppercase) to make a selection of several lines (more than one 
line).  Select lines by moving down, so that the text cursor is at the bottom 
of the visually-selected area.
3. press 'y' to do a yank.
4. following the yank, observe that the text cursor is now positioned on the 
first line of the previously selected area. This is usual behavior.

What is the expected output? 

The lines are yanked, and relative numbering is updated for the lines above and 
below the previously-selected area, to reflect the fact that the text cursor 
jumped to the top of the selected-lines area after the yank.

What do you see instead?

The relative numbering is wrong. Although the text cursor jumped to the top of 
the selected area when the yank was done, relative numbers were not updated.  
They are stale.

If the text cursor is moved at all (via j, k for example) relative numbering 
immediately updates, and the proper relative numbers now show.

What version of the product are you using? On what operating system?

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 15 2014 11:22:43)
MS-Windows 32-bit GUI version
Included patches: 1-326
Huge version with GUI.

Please provide any additional information below.

Also tried using gvim -u NONE, same result.

I have an earlier gVim 7.4 patched to level 86 (only), and the problem does 
*not* occur there. I also have a somewhat later gVim 7.4 patched to 295, and 
the problem *does* occur there. So I conclude the issue was introduced 
somewhere between patches 86 and 295.

Thanks
-- David Kotchan

Original issue reported on code.google.com by dkotc...@gmail.com on 15 Jun 2014 at 7:05

GoogleCodeExporter commented 9 years ago
Looks like patch 7.4.285 also needs to apply for yanking.

Something like this patch seems to do it:
diff --git a/src/ops.c b/src/ops.c
--- a/src/ops.c
+++ b/src/ops.c
@@ -3159,6 +3159,8 @@ op_yank(oap, deleting, mess)
        vim_free(y_current->y_array);
        y_current = curr;
     }
+    if (curwin->w_p_rnu)
+       redraw_later(SOME_VALID);
     if (mess)                  /* Display message about yank? */
     {
        if (yanktype == MCHAR

Original comment by chrisbr...@googlemail.com on 15 Jun 2014 at 8:39

GoogleCodeExporter commented 9 years ago
BTW: it looks like patch 7.4.219 causes this regression

Original comment by chrisbr...@googlemail.com on 15 Jun 2014 at 9:01

GoogleCodeExporter commented 9 years ago

Original comment by chrisbr...@googlemail.com on 2 Oct 2014 at 7:46