Hi Robert!
On So, 11 Mai 2014, Robert Arkwright wrote:
> I may have discovered a bug with relative line numbers in Vim 7.4.
>
> To reproduce:
>
> * Launch Vim with default configuration (no ~/.vimrc or ~/.vim directory).
> * Immediately enter insert mode (i).
> * Enter ten lines of text. I will enter "one", "two", ..., into each line.
> * Exit insert mode (<esc>).
> * Turn on relative line numbering (:set relativenumber<CR>).
> * Move your cursor to the fifth line (5k).
> * Delete three lines (dddddd).
> * Undo the deletions (uuu).
> * The relative line numbers below the current line now display "0".
> * The current relative line numbers (top to bottom) are: 4321000045.
> * I expected the line numbers (top to bottom) to be: 4321012345.
>
> Moving the cursor after undoing the deletions resets the line numbering to
> the expected state.
>
> I have added the following line to my ~/.vimrc to work around this problem:
>
> noremap u ukj
You could have simply used
nnoremap u u<C-L>
>
> I am using MacVim Snapshot 73 on OS X 10.7.5.
>
> A slightly redacted bugreport.txt is attached.
>
> Thank you for your attention!
I already some unexpected line numbers after deleting. And then again
after undoing.
Here is a patch, that forces a correct redraw after those two commands.
Best,
Christian
--
Ein Künstler, der schätzbare Arbeiten verfertiget, ist nicht
immer imstande, von eignen oder fremden Werken Rechenschaft zu geben.
-- Goethe, Maximen und Reflektionen, Nr. 1122
--
--
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
@@ -1923,6 +1923,9 @@ do_pending_operator(cap, old_col, gui_ya
if (oap->motion_type == MLINE && has_format_option(FO_AUTO))
u_save_cursor(); /* cursor line wasn't saved yet */
auto_format(FALSE, TRUE);
+ if (curwin->w_p_rnu)
+ /* relative numbering needs update */
+ redraw_later(SOME_VALID);
}
break;
diff --git a/src/undo.c b/src/undo.c
--- a/src/undo.c
+++ b/src/undo.c
@@ -2665,6 +2665,7 @@ u_undo_end(did_undo, absolute)
char *msgstr;
u_header_T *uhp;
char_u msgbuf[80];
+ win_T *wp;
#ifdef FEAT_FOLDING
if ((fdo_flags & FDO_UNDO) && KeyTyped)
@@ -2717,17 +2718,16 @@ u_undo_end(did_undo, absolute)
else
u_add_time(msgbuf, sizeof(msgbuf), uhp->uh_time);
+
+ FOR_ALL_WINDOWS(wp)
+ {
+ if (wp->w_buffer == curbuf && (wp->w_p_rnu
#ifdef FEAT_CONCEAL
- {
- win_T *wp;
-
- FOR_ALL_WINDOWS(wp)
- {
- if (wp->w_buffer == curbuf && wp->w_p_cole > 0)
- redraw_win_later(wp, NOT_VALID);
- }
+ || wp->w_p_cole > 0
+#endif
+ ))
+ redraw_win_later(wp, NOT_VALID);
}
-#endif
smsg((char_u *)_("%ld %s; %s #%ld %s"),
u_oldcount < 0 ? -u_oldcount : u_oldcount,