From c3b44858dc9d9eeda4863ed6ffafbeb446374465 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 3 Jun 2021 17:45:12 +0300 Subject: [PATCH] Fix fill-column-indicator on TTY frames * src/xdisp.c (extend_face_to_end_of_line): Fix calculation of fill-column-indicator on TTY frames. Suggested by Jimmy Aguilar Mena . --- src/xdisp.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 0e8672961ae..e761ef8b37c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -22386,15 +22386,23 @@ extend_face_to_end_of_line (struct it *it) it->face_id = (it->glyph_row->ends_at_zv_p ? default_face->id : face->id); - /* Display fill-column indicator if needed. */ - const int indicator_column = fill_column_indicator_column (it, 1); - /* Make sure our idea of current_x is in sync with the glyphs actually in the glyph row. They might differ because append_space_for_newline can insert one glyph without updating current_x. */ it->current_x = it->glyph_row->used[TEXT_AREA]; + /* The above assignment causes the code below to use a + non-standard semantics of it->current_x: it is measured + relative to the beginning of the text-area, thus disregarding + the window's hscroll. That is why we need to correct the + indicator column for the hscroll, otherwise the indicator + will not move together with the text as result of horizontal + scrolling. */ + const int indicator_column = + fill_column_indicator_column (it, 1) - it->first_visible_x; + + /* Display fill-column indicator if needed. */ while (it->current_x <= it->last_visible_x) { if (it->current_x != indicator_column) -- 2.39.2