From 2551d28fe8344e0c122489965abc6c91d65bca06 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 18 Oct 2017 19:16:16 +0300 Subject: [PATCH] Fix line number display after 'widen' * src/xdisp.c (maybe_produce_line_number): Don't use data cached by line-number-mode on the first redisplay after the buffer is widened. (Bug#28879) --- src/xdisp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index b14b7daf2b0..6d9acecb424 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -20889,9 +20889,11 @@ maybe_produce_line_number (struct it *it) && it->w->base_line_pos <= IT_CHARPOS (*it) /* line-number-mode always displays narrowed line numbers, so we cannot use its data if the user wants - line numbers that disregard narrowing. */ + line numbers that disregard narrowing, or if the + buffer's narrowing has just changed. */ && !(display_line_numbers_widen - && (BEG_BYTE != BEGV_BYTE || Z_BYTE != ZV_BYTE))) + && (BEG_BYTE != BEGV_BYTE || Z_BYTE != ZV_BYTE)) + && !current_buffer->clip_changed) { start_from = CHAR_TO_BYTE (it->w->base_line_pos); last_line = it->w->base_line_number - 1; -- 2.39.5