[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/long-lines-cleanup 0cc8d6826ad: Three final fixes to last change
From: |
Gregory Heytings |
Subject: |
scratch/long-lines-cleanup 0cc8d6826ad: Three final fixes to last changes |
Date: |
Sat, 1 Apr 2023 17:42:49 -0400 (EDT) |
branch: scratch/long-lines-cleanup
commit 0cc8d6826ad2717a3fd21240d0c97232536cab93
Author: Gregory Heytings <gregory@heytings.org>
Commit: Gregory Heytings <gregory@heytings.org>
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.
---
src/xdisp.c | 6 +++---
1 file 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);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- scratch/long-lines-cleanup 0cc8d6826ad: Three final fixes to last changes,
Gregory Heytings <=