[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/fix-the-long-lines-display-bug cc7f37b2a4: Further improvements
From: |
Gregory Heytings |
Subject: |
feature/fix-the-long-lines-display-bug cc7f37b2a4: Further improvements to long lines handling. |
Date: |
Mon, 18 Jul 2022 06:11:35 -0400 (EDT) |
branch: feature/fix-the-long-lines-display-bug
commit cc7f37b2a41afe2dccd015de2b2a70e20c6e323f
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>
Further improvements to long lines handling.
* src/xdisp.c (get_visually_first_element): Fix segfault.
(get_narrowed_begv): Specific improvement for character-only terminals.
---
src/xdisp.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 98bf15a859..d69d7440bc 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3501,9 +3501,12 @@ init_iterator (struct it *it, struct window *w,
ptrdiff_t
get_narrowed_begv (struct window *w)
{
- int len; ptrdiff_t begv;
- len = 3 * (window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS) *
- window_body_height (w, WINDOW_BODY_IN_CANONICAL_CHARS));
+ int len, fact; ptrdiff_t begv;
+ /* In a character-only terminal, only one font size is used, so we
+ can use a smaller factor. */
+ fact = EQ (Fterminal_live_p (Qnil), Qt) ? 2 : 3;
+ len = fact * (window_body_width (w, WINDOW_BODY_IN_CANONICAL_CHARS) *
+ window_body_height (w, WINDOW_BODY_IN_CANONICAL_CHARS));
begv = max ((window_point (w) / len - 1) * len, BEGV);
return begv == BEGV ? 0 : begv;
}
@@ -8668,6 +8671,16 @@ get_visually_first_element (struct it *it)
SET_WITH_NARROWED_BEGV (it, bob, string_p ? 0 : BEGV);
+ /* Reseat again when, as a consequence of the SET_WITH_NARROWED_BEGV
+ above, the iterator is before bob. */
+ if (!string_p && IT_CHARPOS (*it) < bob)
+ {
+ struct text_pos pos;
+ pos.charpos = bob;
+ pos.bytepos = CHAR_TO_BYTE (bob);
+ reseat (it, pos, true);
+ }
+
if (STRINGP (it->string))
{
it->bidi_it.charpos = IT_STRING_CHARPOS (*it);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- feature/fix-the-long-lines-display-bug cc7f37b2a4: Further improvements to long lines handling.,
Gregory Heytings <=