aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1994-02-14 19:44:36 +0000
committerKarl Heuer1994-02-14 19:44:36 +0000
commit1b15e5760b558305894f1a8e39e5a1d634a5d936 (patch)
tree8b5702bec9a20b1a9ec298e4ec1599efbda829f7 /src
parent9f4123325998eb089e8f9faf486cd5ccb76ecf78 (diff)
downloademacs-1b15e5760b558305894f1a8e39e5a1d634a5d936.tar.gz
emacs-1b15e5760b558305894f1a8e39e5a1d634a5d936.zip
(indented_beyond_p): New function.
(compute_motion, vmotion): Use it to treat blank lines specially in selective display.
Diffstat (limited to 'src')
-rw-r--r--src/indent.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/indent.c b/src/indent.c
index fcc7fc431f1..cafe6122e91 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -271,6 +271,18 @@ position_indentation (pos)
271 } 271 }
272 } 272 }
273} 273}
274
275/* Test whether the line beginning at POS is indented beyond COLUMN.
276 Blank lines are treated as if they had the same indentation as the
277 preceding line. */
278int
279indented_beyond_p (pos, column)
280 int pos, column;
281{
282 while (pos > BEGV && FETCH_CHAR (pos) == '\n')
283 pos = find_next_newline (pos - 1, -1);
284 return (position_indentation (pos) >= column);
285}
274 286
275DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, 0, 287DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, 0,
276 "Move point to column COLUMN in the current line.\n\ 288 "Move point to column COLUMN in the current line.\n\
@@ -499,14 +511,14 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta
499 } 511 }
500 else if (c == '\n') 512 else if (c == '\n')
501 { 513 {
502 if (selective > 0 && position_indentation (pos + 1) >= selective) 514 if (selective > 0 && indented_beyond_p (pos + 1, selective))
503 { 515 {
504 /* Skip any number of invisible lines all at once */ 516 /* Skip any number of invisible lines all at once */
505 do 517 do
506 { 518 {
507 while (++pos < to && FETCH_CHAR (pos) != '\n'); 519 while (++pos < to && FETCH_CHAR (pos) != '\n');
508 } 520 }
509 while (pos < to && position_indentation (pos + 1) >= selective); 521 while (pos < to && indented_beyond_p (pos + 1, selective));
510 pos--; /* Reread the newline on the next pass. */ 522 pos--; /* Reread the newline on the next pass. */
511 /* Allow for the " ..." that is displayed for them. */ 523 /* Allow for the " ..." that is displayed for them. */
512 if (selective_rlen) 524 if (selective_rlen)
@@ -648,7 +660,7 @@ vmotion (from, vtarget, width, hscroll, window)
648 prevline = find_next_newline (from, -1); 660 prevline = find_next_newline (from, -1);
649 while (prevline > BEGV 661 while (prevline > BEGV
650 && ((selective > 0 662 && ((selective > 0
651 && position_indentation (prevline) >= selective) 663 && indented_beyond_p (prevline, selective))
652#ifdef USE_TEXT_PROPERTIES 664#ifdef USE_TEXT_PROPERTIES
653 /* watch out for newlines with `invisible' property */ 665 /* watch out for newlines with `invisible' property */
654 || ! NILP (Fget_text_property (XFASTINT (prevline), 666 || ! NILP (Fget_text_property (XFASTINT (prevline),
@@ -685,7 +697,7 @@ vmotion (from, vtarget, width, hscroll, window)
685 prevline = find_next_newline (prevline - 1, -1); 697 prevline = find_next_newline (prevline - 1, -1);
686 if (prevline == BEGV 698 if (prevline == BEGV
687 || ((selective <= 0 699 || ((selective <= 0
688 || position_indentation (prevline) < selective) 700 || ! indented_beyond_p (prevline, selective))
689#ifdef USE_TEXT_PROPERTIES 701#ifdef USE_TEXT_PROPERTIES
690 /* watch out for newlines with `invisible' property */ 702 /* watch out for newlines with `invisible' property */
691 && NILP (Fget_text_property (XFASTINT (prevline), 703 && NILP (Fget_text_property (XFASTINT (prevline),