aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2024-06-27 15:36:28 -0400
committerStefan Monnier2024-07-06 15:07:06 -0400
commit83234cc1dbbe19450d2fc8cc27509ee4b05c4877 (patch)
tree2afe3ddad3e57ac39d9bd6f2e74df2238a37c852 /src
parent48f4c9cbbc1297eeb2299928bd415c891b98d999 (diff)
downloademacs-83234cc1dbbe19450d2fc8cc27509ee4b05c4877.tar.gz
emacs-83234cc1dbbe19450d2fc8cc27509ee4b05c4877.zip
(buf_bytepos_to_charpos): Fix mixup introduced in commit b300052fb4ef
Backport of commit 1b595b4598e7 since it turns out this "minor typo" had disastrous consequences in pathological cases and explains some of the problems seen in bug#71644 and bug#63040. * src/marker.c (buf_bytepos_to_charpos): Don't compare byte-positions with char-positions.
Diffstat (limited to 'src')
-rw-r--r--src/marker.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/marker.c b/src/marker.c
index f016bf9c088..9aaa2e7402c 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -358,11 +358,11 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
358 { 358 {
359 CONSIDER (tail->bytepos, tail->charpos); 359 CONSIDER (tail->bytepos, tail->charpos);
360 360
361 /* If we are down to a range of 50 chars, 361 /* If we are down to a range of DISTANCE bytes,
362 don't bother checking any other markers; 362 don't bother checking any other markers;
363 scan the intervening chars directly now. */ 363 scan the intervening chars directly now. */
364 if (best_above - bytepos < distance 364 if (best_above_byte - bytepos < distance
365 || bytepos - best_below < distance) 365 || bytepos - best_below_byte < distance)
366 break; 366 break;
367 else 367 else
368 distance += BYTECHAR_DISTANCE_INCREMENT; 368 distance += BYTECHAR_DISTANCE_INCREMENT;