diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2013-03-08 13:34:35 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2013-03-08 13:34:35 +0400 |
commit | b5426561089d39f18b42bed9dbfcb531f43ed562 (patch) | |
tree | ea345a9966321890c6abc989182429a5f76de121 /src/indent.c | |
parent | c3e2de4c1a98a45557008700c3e0a654ecdbe447 (diff) | |
download | emacs-b5426561089d39f18b42bed9dbfcb531f43ed562.tar.gz |
* search.c (find_newline): Accept start and end byte positions
as arguments and allow -1 if not known.
(find_newline_no_quit): Likewise for start position.
* lisp.h (find_newline, find_newline_no_quit): Adjust prototype.
* bidi.c (bidi_find_paragraph_start): Pass byte position to
find_newline_no_quit, thus eliminating CHAR_TO_BYTE.
* editfns.c (Fconstrain_to_field): Break long line. Adjust
call to find_newline.
* indent.c (vmotion): Adjust calls to find_newline_no_quit.
Use DEC_BOTH to start next search from the previous buffer
position, where appropriate.
* xdisp.c (back_to_previous_line_start, forward_to_next_line_start)
(get_visually_first_element, move_it_vertically_backward): Likewise.
Obtain byte position from the display iterator, where appropriate.
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/indent.c b/src/indent.c index fd692f0b149..d1f95da6bcf 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1840,10 +1840,13 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte, while ((vpos > vtarget || first) && from > BEGV) { - ptrdiff_t bytepos; + ptrdiff_t bytepos = from_byte; Lisp_Object propval; - prevline = find_newline_no_quit (from - 1, -1, &bytepos); + prevline = from; + DEC_BOTH (prevline, bytepos); + prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos); + while (prevline > BEGV && ((selective > 0 && indented_beyond_p (prevline, bytepos, selective)) @@ -1853,7 +1856,10 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte, Qinvisible, text_prop_object), TEXT_PROP_MEANS_INVISIBLE (propval)))) - prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); + { + DEC_BOTH (prevline, bytepos); + prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos); + } pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, /* Don't care for VPOS... */ 1 << (BITS_PER_SHORT - 1), @@ -1890,7 +1896,7 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte, ptrdiff_t bytepos; Lisp_Object propval; - prevline = find_newline_no_quit (from, -1, &bytepos); + prevline = find_newline_no_quit (from, from_byte, -1, &bytepos); while (prevline > BEGV && ((selective > 0 && indented_beyond_p (prevline, bytepos, selective)) @@ -1900,7 +1906,10 @@ vmotion (register ptrdiff_t from, register ptrdiff_t from_byte, Qinvisible, text_prop_object), TEXT_PROP_MEANS_INVISIBLE (propval)))) - prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); + { + DEC_BOTH (prevline, bytepos); + prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos); + } pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, /* Don't care for VPOS... */ 1 << (BITS_PER_SHORT - 1), |