summaryrefslogtreecommitdiff
path: root/src/marker.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-08-02 10:38:53 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-08-02 13:06:51 -0400
commit8783700b23e70874c4996908bf02c010ae6f3fe1 (patch)
tree336774be59789fcf172e0722c18d1a6d9a5952ee /src/marker.c
parent344b48f490416cb1200e19b28d356e7fb5b04387 (diff)
downloademacs-8783700b23e70874c4996908bf02c010ae6f3fe1.tar.gz
* src/xdisp.c (redisplay_window): Use BEG rather than hard coding 1
Diffstat (limited to 'src/marker.c')
-rw-r--r--src/marker.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/marker.c b/src/marker.c
index 3c8e628762e..9727586f424 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);