* src/xdisp.c (get_visually_first_element)
(Fbidi_find_overridden_directionality):
* src/cmds.c (Fend_of_line): Use FETCH_BYTE instead of FETCH_CHAR,
and byte position instead of character position, to access
individual bytes of buffer text. This avoids producing invalid
characters and accessing wrong buffer positions. (Bug#41520)
SET_PT (newpos);
if (PT > newpos
- && FETCH_CHAR (PT - 1) == '\n')
+ && FETCH_BYTE (PT_BYTE - 1) == '\n')
{
/* If we skipped over a newline that follows
an invisible intangible run,
break;
}
else if (PT > newpos && PT < ZV
- && FETCH_CHAR (PT) != '\n')
+ && FETCH_BYTE (PT_BYTE) != '\n')
/* If we skipped something intangible
and now we're not really at eol,
keep going. */
}
else if (it->bidi_it.charpos == bob
|| (!string_p
- && (FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n'
- || FETCH_CHAR (it->bidi_it.bytepos) == '\n')))
+ && (FETCH_BYTE (it->bidi_it.bytepos - 1) == '\n'
+ || FETCH_BYTE (it->bidi_it.bytepos) == '\n')))
{
/* If we are at the beginning of a line/string, we can produce
the next element right away. */
itb.charpos = BEGV;
itb.bytepos = BEGV_BYTE;
}
- else if (FETCH_CHAR (from_bpos - 1) == '\n')
+ else if (FETCH_BYTE (from_bpos - 1) == '\n')
{
itb.charpos = from_pos;
itb.bytepos = from_bpos;