emacs-diffs
[Top][All Lists]
Advanced

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

master 8783700b23 2/2: * src/xdisp.c (redisplay_window): Use BEG rather


From: Stefan Monnier
Subject: master 8783700b23 2/2: * src/xdisp.c (redisplay_window): Use BEG rather than hard coding 1
Date: Tue, 2 Aug 2022 13:08:31 -0400 (EDT)

branch: master
commit 8783700b23e70874c4996908bf02c010ae6f3fe1
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * src/xdisp.c (redisplay_window): Use BEG rather than hard coding 1
---
 src/marker.c | 5 +++--
 src/xdisp.c  | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/marker.c b/src/marker.c
index 3c8e628762..9727586f42 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -214,11 +214,12 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t 
charpos)
      We have one known above and one known below.
      Scan, counting characters, from whichever one is closer.  */
 
+  eassert (best_below <= charpos && charpos <= best_above);
   if (charpos - best_below < best_above - charpos)
     {
       bool record = charpos - best_below > 5000;
 
-      while (best_below != charpos)
+      while (best_below < charpos)
        {
          best_below++;
          best_below_byte += buf_next_char_len (b, best_below_byte);
@@ -243,7 +244,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
     {
       bool record = best_above - charpos > 5000;
 
-      while (best_above != charpos)
+      while (best_above > charpos)
        {
          best_above--;
          best_above_byte -= buf_prev_char_len (b, best_above_byte);
diff --git a/src/xdisp.c b/src/xdisp.c
index 65d9221a15..2bedf1c784 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19449,7 +19449,7 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
     {
       ptrdiff_t cur, next, found, max = 0, threshold;
       threshold = XFIXNUM (Vlong_line_threshold);
-      for (cur = 1; cur < Z; cur = next)
+      for (cur = BEG; cur < Z; cur = next)
        {
          next = find_newline1 (cur, CHAR_TO_BYTE (cur), 0, -1, 1,
                                &found, NULL, true);



reply via email to

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