]> git.eshelyaron.com Git - emacs.git/commitdiff
(buf_bytepos_to_charpos): Fix mixup introduced in commit b300052fb4ef
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 27 Jun 2024 19:36:28 +0000 (15:36 -0400)
committerEshel Yaron <me@eshelyaron.com>
Fri, 28 Jun 2024 05:52:09 +0000 (07:52 +0200)
* src/marker.c (buf_bytepos_to_charpos): Don't compare byte-positions
with char-positions.

(cherry picked from commit b595b4598e7b3dabe4d45895f5580c9a351f2885)

src/marker.c

index f016bf9c0889ce26176fbff9fe43ed3f51c32707..9aaa2e7402cbf4fe56accff4779de570e216c7d0 100644 (file)
@@ -358,11 +358,11 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
     {
       CONSIDER (tail->bytepos, tail->charpos);
 
-      /* If we are down to a range of 50 chars,
+      /* If we are down to a range of DISTANCE bytes,
         don't bother checking any other markers;
         scan the intervening chars directly now.  */
-      if (best_above - bytepos < distance
-          || bytepos - best_below < distance)
+      if (best_above_byte - bytepos < distance
+          || bytepos - best_below_byte < distance)
        break;
       else
         distance += BYTECHAR_DISTANCE_INCREMENT;