diff options
author | Kenichi Handa <handa@m17n.org> | 1997-03-05 01:42:06 +0000 |
---|---|---|
committer | Kenichi Handa <handa@m17n.org> | 1997-03-05 01:42:06 +0000 |
commit | bb11924f23f27401f7fa060abce6d2f6d81a0067 (patch) | |
tree | 26b59dc8515026c4aae50da7d10d62e297dbba2d /src/indent.c | |
parent | 0f2424ecf52905b9914284dae7f65d08e93eeccd (diff) | |
download | emacs-bb11924f23f27401f7fa060abce6d2f6d81a0067.tar.gz |
(compute_motion): When POS >= TO, don't call
find_before_next_newline() as it assumes POS < TO.
Diffstat (limited to 'src/indent.c')
-rw-r--r-- | src/indent.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/indent.c b/src/indent.c index ea0de2a10d6..507b8e36cbe 100644 --- a/src/indent.c +++ b/src/indent.c @@ -1261,21 +1261,26 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, { 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 @@ compute_motion (from, fromvpos, fromhpos, did_motion, to, tovpos, tohpos, width, /* 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. */ |