diff options
| author | Karl Heuer | 1995-01-24 07:01:08 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-01-24 07:01:08 +0000 |
| commit | 2ff4775b139cc64fa9a2443bd2b17173e11f59f4 (patch) | |
| tree | f11f8e7a667bed1708479c3c26ec07723bb602c4 /src | |
| parent | 632e95254c51d77773b3ffb9d2ba1c43b9b32268 (diff) | |
| download | emacs-2ff4775b139cc64fa9a2443bd2b17173e11f59f4.tar.gz emacs-2ff4775b139cc64fa9a2443bd2b17173e11f59f4.zip | |
(compute_motion): Don't get hung in selective-display loop.
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/indent.c b/src/indent.c index 4f93951c1bf..99a9f13b431 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Indentation functions. | 1 | /* Indentation functions. |
| 2 | Copyright (C) 1985,86,87,88,93,94 Free Software Foundation, Inc. | 2 | Copyright (C) 1985,86,87,88,93,94,95 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -121,7 +121,7 @@ disptab_matches_widthtab (disptab, widthtab) | |||
| 121 | return 0; | 121 | return 0; |
| 122 | 122 | ||
| 123 | return 1; | 123 | return 1; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /* Recompute BUF's width table, using the display table DISPTAB. */ | 126 | /* Recompute BUF's width table, using the display table DISPTAB. */ |
| 127 | void | 127 | void |
| @@ -161,7 +161,7 @@ width_run_cache_on_off () | |||
| 161 | { | 161 | { |
| 162 | /* It should be on. */ | 162 | /* It should be on. */ |
| 163 | if (current_buffer->width_run_cache == 0) | 163 | if (current_buffer->width_run_cache == 0) |
| 164 | { | 164 | { |
| 165 | current_buffer->width_run_cache = new_region_cache (); | 165 | current_buffer->width_run_cache = new_region_cache (); |
| 166 | recompute_width_table (current_buffer, buffer_display_table ()); | 166 | recompute_width_table (current_buffer, buffer_display_table ()); |
| 167 | } | 167 | } |
| @@ -347,9 +347,9 @@ position_indentation (pos) | |||
| 347 | register int tab_width = XINT (current_buffer->tab_width); | 347 | register int tab_width = XINT (current_buffer->tab_width); |
| 348 | register unsigned char *p; | 348 | register unsigned char *p; |
| 349 | register unsigned char *stop; | 349 | register unsigned char *stop; |
| 350 | 350 | ||
| 351 | if (tab_width <= 0 || tab_width > 1000) tab_width = 8; | 351 | if (tab_width <= 0 || tab_width > 1000) tab_width = 8; |
| 352 | 352 | ||
| 353 | stop = &FETCH_CHAR (BUFFER_CEILING_OF (pos)) + 1; | 353 | stop = &FETCH_CHAR (BUFFER_CEILING_OF (pos)) + 1; |
| 354 | p = &FETCH_CHAR (pos); | 354 | p = &FETCH_CHAR (pos); |
| 355 | while (1) | 355 | while (1) |
| @@ -527,7 +527,7 @@ struct position val_compute_motion; | |||
| 527 | and the window's upper-left coordinates as FROMVPOS and FROMHPOS. | 527 | and the window's upper-left coordinates as FROMVPOS and FROMHPOS. |
| 528 | Pass the buffer's ZV as TO, to limit the scan to the end of the | 528 | Pass the buffer's ZV as TO, to limit the scan to the end of the |
| 529 | visible section of the buffer, and pass LINE and COL as TOVPOS and | 529 | visible section of the buffer, and pass LINE and COL as TOVPOS and |
| 530 | TOHPOS. | 530 | TOHPOS. |
| 531 | 531 | ||
| 532 | When displaying in window w, a typical formula for WIDTH is: | 532 | When displaying in window w, a typical formula for WIDTH is: |
| 533 | 533 | ||
| @@ -581,7 +581,7 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 581 | 581 | ||
| 582 | /* For computing runs of characters with similar widths. | 582 | /* For computing runs of characters with similar widths. |
| 583 | Invariant: width_run_width is zero, or all the characters | 583 | Invariant: width_run_width is zero, or all the characters |
| 584 | from width_run_start to width_run_end have a fixed width of | 584 | from width_run_start to width_run_end have a fixed width of |
| 585 | width_run_width. */ | 585 | width_run_width. */ |
| 586 | int width_run_start = from; | 586 | int width_run_start = from; |
| 587 | int width_run_end = from; | 587 | int width_run_end = from; |
| @@ -675,7 +675,7 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 675 | run_end = pos + (tohpos - hpos) / common_width; | 675 | run_end = pos + (tohpos - hpos) / common_width; |
| 676 | run_end_hpos = hpos + (run_end - pos) * common_width; | 676 | run_end_hpos = hpos + (run_end - pos) * common_width; |
| 677 | } | 677 | } |
| 678 | 678 | ||
| 679 | /* Don't go past the margin. */ | 679 | /* Don't go past the margin. */ |
| 680 | if (run_end_hpos >= width) | 680 | if (run_end_hpos >= width) |
| 681 | { | 681 | { |
| @@ -712,13 +712,13 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 712 | else | 712 | else |
| 713 | { | 713 | { |
| 714 | /* Have we accumulated a run to put in the cache? | 714 | /* Have we accumulated a run to put in the cache? |
| 715 | (Currently, we only cache runs of width == 1. */ | 715 | (Currently, we only cache runs of width == 1). */ |
| 716 | if (width_run_start < width_run_end | 716 | if (width_run_start < width_run_end |
| 717 | && width_run_width == 1) | 717 | && width_run_width == 1) |
| 718 | know_region_cache (current_buffer, | 718 | know_region_cache (current_buffer, |
| 719 | current_buffer->width_run_cache, | 719 | current_buffer->width_run_cache, |
| 720 | width_run_start, width_run_end); | 720 | width_run_start, width_run_end); |
| 721 | 721 | ||
| 722 | /* Start recording a new width run. */ | 722 | /* Start recording a new width run. */ |
| 723 | width_run_width = width_table[c]; | 723 | width_run_width = width_table[c]; |
| 724 | width_run_start = pos - 1; | 724 | width_run_start = pos - 1; |
| @@ -745,7 +745,7 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 745 | { | 745 | { |
| 746 | /* Skip any number of invisible lines all at once */ | 746 | /* Skip any number of invisible lines all at once */ |
| 747 | do | 747 | do |
| 748 | pos = find_before_next_newline (pos, to, 1); | 748 | pos = find_before_next_newline (pos, to, 1) + 1; |
| 749 | while (pos < to | 749 | while (pos < to |
| 750 | && indented_beyond_p (pos, selective)); | 750 | && indented_beyond_p (pos, selective)); |
| 751 | /* Allow for the " ..." that is displayed for them. */ | 751 | /* Allow for the " ..." that is displayed for them. */ |
| @@ -755,6 +755,7 @@ compute_motion (from, fromvpos, fromhpos, to, tovpos, tohpos, width, hscroll, ta | |||
| 755 | if (hpos >= width) | 755 | if (hpos >= width) |
| 756 | hpos = width; | 756 | hpos = width; |
| 757 | } | 757 | } |
| 758 | --pos; | ||
| 758 | /* We have skipped the invis text, but not the | 759 | /* We have skipped the invis text, but not the |
| 759 | newline after. */ | 760 | newline after. */ |
| 760 | } | 761 | } |
| @@ -990,7 +991,7 @@ vmotion (from, vtarget, width, hscroll, window) | |||
| 990 | retry: | 991 | retry: |
| 991 | if (vtarget > vpos) | 992 | if (vtarget > vpos) |
| 992 | { | 993 | { |
| 993 | /* Moving downward is simple, but must calculate from beg of line | 994 | /* Moving downward is simple, but must calculate from beg of line |
| 994 | to determine hpos of starting point */ | 995 | to determine hpos of starting point */ |
| 995 | if (from > BEGV && FETCH_CHAR (from - 1) != '\n') | 996 | if (from > BEGV && FETCH_CHAR (from - 1) != '\n') |
| 996 | { | 997 | { |
| @@ -1070,7 +1071,7 @@ vmotion (from, vtarget, width, hscroll, window) | |||
| 1070 | val_vmotion.prevhpos = 0; | 1071 | val_vmotion.prevhpos = 0; |
| 1071 | return &val_vmotion; | 1072 | return &val_vmotion; |
| 1072 | } | 1073 | } |
| 1073 | 1074 | ||
| 1074 | /* Otherwise find the correct spot by moving down */ | 1075 | /* Otherwise find the correct spot by moving down */ |
| 1075 | goto retry; | 1076 | goto retry; |
| 1076 | } | 1077 | } |