static void
back_to_previous_line_start (struct it *it)
{
- IT_CHARPOS (*it) = find_newline_no_quit (IT_CHARPOS (*it) - 1, -1,
- &IT_BYTEPOS (*it));
+ ptrdiff_t cp = IT_CHARPOS (*it), bp = IT_BYTEPOS (*it);
+
+ DEC_BOTH (cp, bp);
+ IT_CHARPOS (*it) = find_newline_no_quit (cp, bp, -1, &IT_BYTEPOS (*it));
}
if (!newline_found_p)
{
ptrdiff_t bytepos, start = IT_CHARPOS (*it);
- ptrdiff_t limit = find_newline_no_quit (start, 1, &bytepos);
+ ptrdiff_t limit = find_newline_no_quit (start, IT_BYTEPOS (*it),
+ 1, &bytepos);
Lisp_Object pos;
eassert (!STRINGP (it->string));
if (string_p)
it->bidi_it.charpos = it->bidi_it.bytepos = 0;
else
- it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it), -1,
+ it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it),
+ IT_BYTEPOS (*it), -1,
&it->bidi_it.bytepos);
bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1);
do
&& IT_CHARPOS (*it) > BEGV
&& FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n')
{
- ptrdiff_t nl_pos = find_newline_no_quit (IT_CHARPOS (*it) - 1, -1,
- NULL);
+ ptrdiff_t cp = IT_CHARPOS (*it), bp = IT_BYTEPOS (*it);
- move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS);
+ DEC_BOTH (cp, bp);
+ cp = find_newline_no_quit (cp, bp, -1, NULL);
+ move_it_to (it, cp, -1, -1, -1, MOVE_TO_POS);
}
bidi_unshelve_cache (it3data, 1);
}