From: Eli Zaretskii Date: Thu, 17 Apr 2014 08:58:59 +0000 (+0300) Subject: Fix bug #17281 with infloop in line-pixel-height. X-Git-Tag: emacs-24.3.91~133 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8915b84286466c88ff1da95148d73e53464a5a89;p=emacs.git 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. --- 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