From 9180cde1125adced11ca5125ebed4e988d776539 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 17 Jul 2014 18:25:21 +0300 Subject: [PATCH] Fix assertion violation when restoring hscrolled window configurations. src/xdisp.c (hscroll_window_tree): Don't try hscrolling windows whose cursor row has zero buffer position as their start position. Reported by Martin Rudalics . --- src/ChangeLog | 3 +++ src/xdisp.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 463c895e5da..737a5078b24 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,9 @@ buffer position where we are to start the iteration. (handle_invisible_prop): Record in it->stop_charpos the position where the invisible text ends. (Bug#18035) + (hscroll_window_tree): Don't try hscrolling windows whose cursor + row has zero buffer position as their start position. Reported by + martin rudalics . 2014-07-16 Eli Zaretskii diff --git a/src/xdisp.c b/src/xdisp.c index 3ab1dd76654..d1016b6b8d7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12880,6 +12880,13 @@ hscroll_window_tree (Lisp_Object window) h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->contents)) + /* In some pathological cases, like restoring a window + configuration into a frame that is much smaller than + the one from which the configuration was saved, we + get glyph rows whose start and end have zero buffer + positions, which we cannot handle below. Just skip + such windows. */ + && CHARPOS (cursor_row->start.pos) >= BUF_BEG (w->contents) /* For left-to-right rows, hscroll when cursor is either (i) inside the right hscroll margin, or (ii) if it is inside the left margin and the window is already -- 2.39.5