diff options
| author | Richard M. Stallman | 1995-03-11 22:32:17 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-03-11 22:32:17 +0000 |
| commit | 66c75ca5f0fe58d9b4e4efa01beaafba67bfcbf9 (patch) | |
| tree | b6b107742c7e77d3fad183547a810d8713fd3119 /src | |
| parent | 47b4c04d0815c835302f15e40fd8601dfc8fae1c (diff) | |
| download | emacs-66c75ca5f0fe58d9b4e4efa01beaafba67bfcbf9.tar.gz emacs-66c75ca5f0fe58d9b4e4efa01beaafba67bfcbf9.zip | |
(compute_motion): Call recenter_overlay_lists sooner.
Use Fnext_property_change to get a quick lower bound for
where `invisible' changes.
(compute_motion, vmotion): Check `invisible' prop
using TEXT_PROP_MEANS_INVISIBLE.
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/src/indent.c b/src/indent.c index 99a9f13b431..520825c375e 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -587,10 +587,13 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 587 | int width_run_end = from; | 587 | int width_run_end = from; |
| 588 | int width_run_width = 0; | 588 | int width_run_width = 0; |
| 589 | Lisp_Object *width_table; | 589 | Lisp_Object *width_table; |
| 590 | Lisp_Object buffer; | ||
| 590 | 591 | ||
| 591 | /* The next buffer pos where we should consult the width run cache. */ | 592 | /* The next buffer pos where we should consult the width run cache. */ |
| 592 | int next_width_run = from; | 593 | int next_width_run = from; |
| 593 | 594 | ||
| 595 | XSETBUFFER (buffer, current_buffer); | ||
| 596 | |||
| 594 | width_run_cache_on_off (); | 597 | width_run_cache_on_off (); |
| 595 | if (dp == buffer_display_table ()) | 598 | if (dp == buffer_display_table ()) |
| 596 | width_table = (VECTORP (current_buffer->width_table) | 599 | width_table = (VECTORP (current_buffer->width_table) |
| @@ -618,25 +621,39 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 618 | while (pos == next_invisible && pos < to) | 621 | while (pos == next_invisible && pos < to) |
| 619 | { | 622 | { |
| 620 | XSETFASTINT (position, pos); | 623 | XSETFASTINT (position, pos); |
| 624 | |||
| 625 | /* Give faster response for overlay lookup near POS. */ | ||
| 626 | recenter_overlay_lists (current_buffer, pos); | ||
| 627 | |||
| 621 | prop = Fget_char_property (position, | 628 | prop = Fget_char_property (position, |
| 622 | Qinvisible, | 629 | Qinvisible, |
| 623 | Fcurrent_buffer ()); | 630 | Fcurrent_buffer ()); |
| 624 | { | 631 | { |
| 625 | Lisp_Object end, limit; | 632 | Lisp_Object end, limit, proplimit; |
| 626 | 633 | ||
| 627 | recenter_overlay_lists (current_buffer, pos); | 634 | /* Get a quit lower bound for how soon property might change. */ |
| 628 | /* This is just an estimate to give reasonable | ||
| 629 | performance; nothing should go wrong if it is too small. */ | ||
| 630 | limit = Fnext_overlay_change (position); | 635 | limit = Fnext_overlay_change (position); |
| 631 | if (XFASTINT (limit) > pos + 100) | 636 | proplimit = Fnext_property_change (position, buffer, Qt); |
| 632 | XSETFASTINT (limit, pos + 100); | 637 | if (XFASTINT (proplimit) < XFASTINT (limit)) |
| 633 | end = Fnext_single_property_change (position, Qinvisible, | 638 | limit = proplimit; |
| 634 | Fcurrent_buffer (), limit); | 639 | /* LIMIT is now a lower bound for the next change |
| 635 | if (INTEGERP (end)) | 640 | in invisible status. If that is plenty far away, |
| 636 | next_invisible = XINT (end); | 641 | use that lower bound. */ |
| 642 | if (XFASTINT (limit) > pos + 100 || XFASTINT (limit) >= to) | ||
| 643 | next_invisible = XINT (limit); | ||
| 644 | /* Otherwise, scan for the next `invisible' property change. */ | ||
| 637 | else | 645 | else |
| 638 | next_invisible = to; | 646 | { |
| 639 | if (! NILP (prop)) | 647 | /* Don't scan terribly far. */ |
| 648 | XSETFASTINT (limit, min (pos + 100, to)); | ||
| 649 | end = Fnext_single_property_change (position, Qinvisible, | ||
| 650 | buffer, limit); | ||
| 651 | if (INTEGERP (end) && XINT (end) < to) | ||
| 652 | next_invisible = XINT (end); | ||
| 653 | else | ||
| 654 | next_invisible = to; | ||
| 655 | } | ||
| 656 | if (TEXT_PROP_MEANS_INVISIBLE (prop)) | ||
| 640 | pos = next_invisible; | 657 | pos = next_invisible; |
| 641 | } | 658 | } |
| 642 | } | 659 | } |
| @@ -995,15 +1012,18 @@ vmotion (from, vtarget, width, hscroll, window) | |||
| 995 | to determine hpos of starting point */ | 1012 | to determine hpos of starting point */ |
| 996 | if (from > BEGV && FETCH_CHAR (from - 1) != '\n') | 1013 | if (from > BEGV && FETCH_CHAR (from - 1) != '\n') |
| 997 | { | 1014 | { |
| 1015 | Lisp_Object propval; | ||
| 1016 | |||
| 998 | XSETFASTINT (prevline, find_next_newline_no_quit (from, -1)); | 1017 | XSETFASTINT (prevline, find_next_newline_no_quit (from, -1)); |
| 999 | while (XFASTINT (prevline) > BEGV | 1018 | while (XFASTINT (prevline) > BEGV |
| 1000 | && ((selective > 0 | 1019 | && ((selective > 0 |
| 1001 | && indented_beyond_p (XFASTINT (prevline), selective)) | 1020 | && indented_beyond_p (XFASTINT (prevline), selective)) |
| 1002 | #ifdef USE_TEXT_PROPERTIES | 1021 | #ifdef USE_TEXT_PROPERTIES |
| 1003 | /* watch out for newlines with `invisible' property */ | 1022 | /* watch out for newlines with `invisible' property */ |
| 1004 | || ! NILP (Fget_char_property (prevline, | 1023 | || (propval = Fget_char_property (prevline, |
| 1005 | Qinvisible, | 1024 | Qinvisible, |
| 1006 | window)) | 1025 | window), |
| 1026 | TEXT_PROP_MEANS_INVISIBLE (propval)) | ||
| 1007 | #endif | 1027 | #endif |
| 1008 | )) | 1028 | )) |
| 1009 | XSETFASTINT (prevline, | 1029 | XSETFASTINT (prevline, |
| @@ -1036,6 +1056,8 @@ vmotion (from, vtarget, width, hscroll, window) | |||
| 1036 | XSETFASTINT (prevline, from); | 1056 | XSETFASTINT (prevline, from); |
| 1037 | while (1) | 1057 | while (1) |
| 1038 | { | 1058 | { |
| 1059 | Lisp_Object propval; | ||
| 1060 | |||
| 1039 | XSETFASTINT (prevline, | 1061 | XSETFASTINT (prevline, |
| 1040 | find_next_newline_no_quit (XFASTINT (prevline) - 1, | 1062 | find_next_newline_no_quit (XFASTINT (prevline) - 1, |
| 1041 | -1)); | 1063 | -1)); |
| @@ -1044,7 +1066,9 @@ vmotion (from, vtarget, width, hscroll, window) | |||
| 1044 | || ! indented_beyond_p (XFASTINT (prevline), selective)) | 1066 | || ! indented_beyond_p (XFASTINT (prevline), selective)) |
| 1045 | #ifdef USE_TEXT_PROPERTIES | 1067 | #ifdef USE_TEXT_PROPERTIES |
| 1046 | /* watch out for newlines with `invisible' property */ | 1068 | /* watch out for newlines with `invisible' property */ |
| 1047 | && NILP (Fget_char_property (prevline, Qinvisible, window)) | 1069 | && (propval = Fget_char_property (prevline, Qinvisible, |
| 1070 | window), | ||
| 1071 | ! TEXT_PROP_MEANS_INVISIBLE (propval)) | ||
| 1048 | #endif | 1072 | #endif |
| 1049 | )) | 1073 | )) |
| 1050 | break; | 1074 | break; |