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.
This commit is contained in:
parent
097c5ee8f5
commit
0cc8d6826a
1 changed files with 3 additions and 3 deletions
|
@ -3616,7 +3616,7 @@ get_medium_narrowing_zv (struct window *w, ptrdiff_t pos)
|
||||||
static ptrdiff_t
|
static ptrdiff_t
|
||||||
get_nearby_bol_pos (ptrdiff_t pos)
|
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;
|
int dist;
|
||||||
for (dist = 500; dist <= 500000; dist *= 10)
|
for (dist = 500; dist <= 500000; dist *= 10)
|
||||||
{
|
{
|
||||||
|
@ -3632,7 +3632,7 @@ get_nearby_bol_pos (ptrdiff_t pos)
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (bol)
|
if (bol >= BEGV || start == BEGV)
|
||||||
return bol;
|
return bol;
|
||||||
else
|
else
|
||||||
pos = pos - dist < BEGV ? BEGV : pos - dist;
|
pos = pos - dist < BEGV ? BEGV : pos - dist;
|
||||||
|
@ -3644,7 +3644,7 @@ ptrdiff_t
|
||||||
get_small_narrowing_begv (struct window *w, ptrdiff_t pos)
|
get_small_narrowing_begv (struct window *w, ptrdiff_t pos)
|
||||||
{
|
{
|
||||||
int len = get_narrowed_width (w);
|
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);
|
return max (bol_pos + ((pos - bol_pos) / len - 1) * len, BEGV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue