# HG changeset patch # User Kenichi Handa # Date 857526126 0 # Node ID 424932eba3e83d1e64434f29f0554afc01237b23 # Parent 1814adcc2648a544691ba2f48d60254957b4289d (compute_motion): When POS >= TO, don't call find_before_next_newline() as it assumes POS < TO. diff -r 1814adcc2648 -r 424932eba3e8 src/indent.c --- a/src/indent.c Tue Mar 04 18:00:30 1997 +0000 +++ b/src/indent.c Wed Mar 05 01:42:06 1997 +0000 @@ -1261,21 +1261,26 @@ { if (selective > 0 && indented_beyond_p (pos, selective)) { - /* Skip any number of invisible lines all at once */ - do - pos = find_before_next_newline (pos, to, 1) + 1; - while (pos < to - && indented_beyond_p (pos, selective)); - /* Allow for the " ..." that is displayed for them. */ - if (selective_rlen) + /* If (pos == to), we don't have to take care of + selective display. */ + if (pos < to) { - hpos += selective_rlen; - if (hpos >= width) - hpos = width; + /* Skip any number of invisible lines all at once */ + do + pos = find_before_next_newline (pos, to, 1) + 1; + while (pos < to + && indented_beyond_p (pos, selective)); + /* Allow for the " ..." that is displayed for them. */ + if (selective_rlen) + { + hpos += selective_rlen; + if (hpos >= width) + hpos = width; + } + --pos; + /* We have skipped the invis text, but not the + newline after. */ } - --pos; - /* We have skipped the invis text, but not the - newline after. */ } else { @@ -1295,7 +1300,8 @@ /* In selective display mode, everything from a ^M to the end of the line is invisible. Stop *before* the real newline. */ - pos = find_before_next_newline (pos, to, 1); + if (pos < to) + pos = find_before_next_newline (pos, to, 1); /* If we just skipped next_boundary, loop around in the main while and handle it. */