Fix more single-byte accesses caused by bytepos/charpos confusion
* src/cmds.c (internal_self_insert): Use FETCH_BYTE, not FETCH_CHAR, for a decremented byte position (bug#41520). * src/xdisp.c (Fwindow_text_pixel_size, trailing_whitespace_p): Ditto.
This commit is contained in:
parent
433b6fc53d
commit
a492013d07
2 changed files with 4 additions and 4 deletions
|
@ -390,7 +390,7 @@ internal_self_insert (int c, EMACS_INT n)
|
|||
by spaces so that the remaining text won't move. */
|
||||
ptrdiff_t actual = PT_BYTE;
|
||||
actual -= prev_char_len (actual);
|
||||
if (FETCH_CHAR (actual) == '\t')
|
||||
if (FETCH_BYTE (actual) == '\t')
|
||||
/* Rather than add spaces, let's just keep the tab. */
|
||||
chars_to_delete--;
|
||||
else
|
||||
|
|
|
@ -10619,7 +10619,7 @@ include the height of both, if present, in the return value. */)
|
|||
while (bpos > BEGV_BYTE)
|
||||
{
|
||||
dec_both (&start, &bpos);
|
||||
c = FETCH_CHAR (bpos);
|
||||
c = FETCH_BYTE (bpos);
|
||||
if (!(c == ' ' || c == '\t'))
|
||||
break;
|
||||
}
|
||||
|
@ -10641,7 +10641,7 @@ include the height of both, if present, in the return value. */)
|
|||
while (bpos > BEGV_BYTE)
|
||||
{
|
||||
dec_both (&end, &bpos);
|
||||
c = FETCH_CHAR (bpos);
|
||||
c = FETCH_BYTE (bpos);
|
||||
if (!(c == ' ' || c == '\t' || c == '\n' || c == '\r'))
|
||||
break;
|
||||
}
|
||||
|
@ -22277,7 +22277,7 @@ trailing_whitespace_p (ptrdiff_t charpos)
|
|||
int c = 0;
|
||||
|
||||
while (bytepos < ZV_BYTE
|
||||
&& (c = FETCH_CHAR (bytepos),
|
||||
&& (c = FETCH_BYTE (bytepos),
|
||||
c == ' ' || c == '\t'))
|
||||
++bytepos;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue