diff options
author | Gregory Heytings <gregory@heytings.org> | 2023-04-01 21:13:08 +0000 |
---|---|---|
committer | Gregory Heytings <gregory@heytings.org> | 2023-04-01 23:42:23 +0200 |
commit | 0cc8d6826ad2717a3fd21240d0c97232536cab93 (patch) | |
tree | aabf0e70037e6c6c6c62cca0e5ab9905d62818db /src | |
parent | 097c5ee8f55580ef2f7e68a5bf91a3ccf07dbeb3 (diff) | |
download | emacs-0cc8d6826ad2717a3fd21240d0c97232536cab93.tar.gz |
Three final fixes to last changes
* src/xdisp.c (get_nearby_bol_pos): Initialize 'bol' to BEGV - 1
instead of 0 (which fixes cursor motion commands in the presence
of a narrowing), adapt the return condition accordingly, and do
not restart the loop when BEGV has been reached.
(get_small_narrowing_begv): Use correct type.
Diffstat (limited to 'src')
-rw-r--r-- | src/xdisp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 62dc3438117..940b8dc820e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -3616,7 +3616,7 @@ get_medium_narrowing_zv (struct window *w, ptrdiff_t pos) static ptrdiff_t get_nearby_bol_pos (ptrdiff_t pos) { - ptrdiff_t start, pos_bytepos, cur, next, found, bol = 0; + ptrdiff_t start, pos_bytepos, cur, next, found, bol = BEGV - 1; int dist; for (dist = 500; dist <= 500000; dist *= 10) { @@ -3632,7 +3632,7 @@ get_nearby_bol_pos (ptrdiff_t pos) else break; } - if (bol) + if (bol >= BEGV || start == BEGV) return bol; else pos = pos - dist < BEGV ? BEGV : pos - dist; @@ -3644,7 +3644,7 @@ ptrdiff_t get_small_narrowing_begv (struct window *w, ptrdiff_t pos) { int len = get_narrowed_width (w); - int bol_pos = get_nearby_bol_pos (pos); + ptrdiff_t bol_pos = get_nearby_bol_pos (pos); return max (bol_pos + ((pos - bol_pos) / len - 1) * len, BEGV); } |