From 8915b84286466c88ff1da95148d73e53464a5a89 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 17 Apr 2014 11:58:59 +0300 Subject: [PATCH] Fix bug #17281 with infloop in line-pixel-height. src/xdisp.c (Fline_pixel_height): Don't assume that the current buffer and the selected window's buffer are one and the same. --- src/ChangeLog | 4 ++++ src/xdisp.c | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index d0aa2e59e01..122b093f2a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2014-04-17 Eli Zaretskii + * xdisp.c (Fline_pixel_height): Don't assume that the current + buffer and the selected window's buffer are one and the same. + (Bug#17281) + * insdel.c (invalidate_buffer_caches): Invalidate the bidi paragraph-start cache before the newline cache. (Bug#17269) diff --git a/src/xdisp.c b/src/xdisp.c index eb3a6df1fc5..ad5f6a6bf83 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1262,12 +1262,23 @@ Value is the height in pixels of the line at point. */) struct it it; struct text_pos pt; struct window *w = XWINDOW (selected_window); + struct buffer *old_buffer = NULL; + Lisp_Object result; + if (XBUFFER (w->contents) != current_buffer) + { + old_buffer = current_buffer; + set_buffer_internal_1 (XBUFFER (w->contents)); + } SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); it.vpos = it.current_y = 0; last_height = 0; - return make_number (line_bottom_y (&it)); + result = make_number (line_bottom_y (&it)); + if (old_buffer) + set_buffer_internal_1 (old_buffer); + + return result; } /* Return the default pixel height of text lines in window W. The -- 2.39.5