emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/long-lines-improvements 43a174f62c: Move the computation of narr


From: Gregory Heytings
Subject: feature/long-lines-improvements 43a174f62c: Move the computation of narrowing bounds for long line optimizations.
Date: Sun, 31 Jul 2022 18:39:53 -0400 (EDT)

branch: feature/long-lines-improvements
commit 43a174f62c50871c0bcb6e4b15144a177f028218
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>

    Move the computation of narrowing bounds for long line optimizations.
    
    * src/xdisp.c (init_iterator): Move the computation from here...
    (reseat): ... to here.  Also recompute the position in certain cases.
---
 src/xdisp.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 88a489e290..8a19b3bda9 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3413,12 +3413,6 @@ init_iterator (struct it *it, struct window *w,
        }
     }
 
-  if (current_buffer->long_line_optimizations_p)
-    {
-      it->narrowed_begv = get_narrowed_begv (w, window_point (w));
-      it->narrowed_zv = get_narrowed_zv (w, window_point (w));
-    }
-
   /* If a buffer position was specified, set the iterator there,
      getting overlays and face properties from that position.  */
   if (charpos >= BUF_BEG (current_buffer))
@@ -7532,6 +7526,17 @@ reseat (struct it *it, struct text_pos pos, bool force_p)
 
   reseat_1 (it, pos, false);
 
+  if (current_buffer->long_line_optimizations_p)
+    {
+      if (!it->narrowed_begv
+         || ((pos.charpos < it->narrowed_begv || pos.charpos > it->narrowed_zv)
+             && (!redisplaying_p || it->line_wrap == TRUNCATE)))
+       {
+         it->narrowed_begv = get_narrowed_begv (it->w, window_point (it->w));
+         it->narrowed_zv = get_narrowed_zv (it->w, window_point (it->w));
+       }
+    }
+
   /* Determine where to check text properties.  Avoid doing it
      where possible because text property lookup is very expensive.  */
   if (force_p



reply via email to

[Prev in Thread] Current Thread [Next in Thread]