[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master c36df52: Fix infloop in lsp-mode
From: |
Eli Zaretskii |
Subject: |
master c36df52: Fix infloop in lsp-mode |
Date: |
Tue, 4 May 2021 13:38:43 -0400 (EDT) |
branch: master
commit c36df52ff5c05826382d88ddbe3fffaa99d12597
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix infloop in lsp-mode
* src/indent.c (line_number_display_width): Make sure the selected
window's buffer is current before using display code on it:
redisplay assumes that the window's buffer is current at all
times. Reported by Evgeny Kurnevsky via lsp-mode's issue 1621,
https://github.com/emacs-lsp/lsp-mode/issues/1621.
---
src/indent.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/indent.c b/src/indent.c
index 6246b54..de6b489 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1967,9 +1967,13 @@ line_number_display_width (struct window *w, int *width,
int *pixel_width)
struct it it;
struct text_pos startpos;
bool saved_restriction = false;
+ struct buffer *old_buf = current_buffer;
ptrdiff_t count = SPECPDL_INDEX ();
SET_TEXT_POS_FROM_MARKER (startpos, w->start);
void *itdata = bidi_shelve_cache ();
+
+ /* Make sure W's buffer is the current one. */
+ set_buffer_internal_1 (XBUFFER (w->contents));
/* We want to start from window's start point, but it could be
outside the accessible region, in which case we widen the
buffer temporarily. It could even be beyond the buffer's end
@@ -1998,6 +2002,7 @@ line_number_display_width (struct window *w, int *width,
int *pixel_width)
*pixel_width = it.lnum_pixel_width;
if (saved_restriction)
unbind_to (count, Qnil);
+ set_buffer_internal_1 (old_buf);
bidi_unshelve_cache (itdata, 0);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master c36df52: Fix infloop in lsp-mode,
Eli Zaretskii <=