From 5b648ac7a2b2e1b77eb59573db59019d5068476c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 24 Jun 2017 12:37:30 +0300 Subject: [PATCH] Fix problems with line-number updates in Follow mode * src/xdisp.c (redisplay_window): If forced window-start requires to move a window's point, and the window is under relative line-number display, force another round of redisplay to update the relative line numbers. This fixes follow-mode "redisplay" of its window group. * lisp/frame.el: Add display-line-numbers to the list of variables that should trigger redisplay of the current buffer. --- lisp/frame.el | 1 + src/xdisp.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/frame.el b/lisp/frame.el index b7a55169281..8f51afa2a9a 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2434,6 +2434,7 @@ See also `toggle-frame-maximized'." line-prefix wrap-prefix truncate-lines + display-line-numbers bidi-paragraph-direction bidi-display-reordering)) diff --git a/src/xdisp.c b/src/xdisp.c index 39176e0e675..9b5762550d7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -16800,10 +16800,14 @@ redisplay_window (Lisp_Object window, bool just_this_one_p) XBUFFER (w->contents)->text->redisplay = false; safe__call1 (true, Vpre_redisplay_function, Fcons (window, Qnil)); - if (w->redisplay || XBUFFER (w->contents)->text->redisplay) - { - /* pre-redisplay-function made changes (e.g. move the region) - that require another round of redisplay. */ + if (w->redisplay || XBUFFER (w->contents)->text->redisplay + || (EQ (Vdisplay_line_numbers, Qrelative) + && row != MATRIX_FIRST_TEXT_ROW (w->desired_matrix))) + { + /* Either pre-redisplay-function made changes (e.g. move + the region), or we moved point in a window that is + under display-line-numbers = relative mode. We need + another round of redisplay. */ clear_glyph_matrix (w->desired_matrix); if (!try_window (window, startp, 0)) goto need_larger_matrices; -- 2.39.2