diff options
| author | Eli Zaretskii | 2013-02-10 18:49:09 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-02-10 18:49:09 +0200 |
| commit | a4ba3963957c289a913b32bca9531aadcc3f377f (patch) | |
| tree | 45df94ea1abaaea67b8f2022f5ef978f416c4fc1 /src | |
| parent | 68643cdeb65ae0f088b13e68ccbf4346f67bfa7e (diff) | |
| download | emacs-a4ba3963957c289a913b32bca9531aadcc3f377f.tar.gz emacs-a4ba3963957c289a913b32bca9531aadcc3f377f.zip | |
Speed up some redisplay operations with very long lines (Bug#13675).
src/xdisp.c (move_it_vertically_backward, move_it_by_lines): When
text lines are longer than window's screen lines, don't move back
too far. This speeds up some redisplay operations.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 19 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 43b8f4b76f7..9d8540075de 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-02-10 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (move_it_vertically_backward, move_it_by_lines): When | ||
| 4 | text lines are longer than window's screen lines, don't move back | ||
| 5 | too far. This speeds up some redisplay operations. (Bug#13675) | ||
| 6 | |||
| 1 | 2013-02-10 Dmitry Antipov <dmantipov@yandex.ru> | 7 | 2013-02-10 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 8 | ||
| 3 | * syntax.c (scan_sexps_forward): Fix byte position calculation | 9 | * syntax.c (scan_sexps_forward): Fix byte position calculation |
diff --git a/src/xdisp.c b/src/xdisp.c index 7434cdf728c..8314e91ad7f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -8992,6 +8992,9 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 8992 | struct it it2, it3; | 8992 | struct it it2, it3; |
| 8993 | void *it2data = NULL, *it3data = NULL; | 8993 | void *it2data = NULL, *it3data = NULL; |
| 8994 | ptrdiff_t start_pos; | 8994 | ptrdiff_t start_pos; |
| 8995 | int nchars_per_row | ||
| 8996 | = (it->last_visible_x - it->first_visible_x) / FRAME_COLUMN_WIDTH (it->f); | ||
| 8997 | ptrdiff_t pos_limit; | ||
| 8995 | 8998 | ||
| 8996 | move_further_back: | 8999 | move_further_back: |
| 8997 | eassert (dy >= 0); | 9000 | eassert (dy >= 0); |
| @@ -9000,9 +9003,12 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 9000 | 9003 | ||
| 9001 | /* Estimate how many newlines we must move back. */ | 9004 | /* Estimate how many newlines we must move back. */ |
| 9002 | nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f)); | 9005 | nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f)); |
| 9006 | pos_limit = max (start_pos - nlines * nchars_per_row, BEGV); | ||
| 9003 | 9007 | ||
| 9004 | /* Set the iterator's position that many lines back. */ | 9008 | /* Set the iterator's position that many lines back. But don't go |
| 9005 | while (nlines-- && IT_CHARPOS (*it) > BEGV) | 9009 | back more than NLINES full screen lines -- this wins a day with |
| 9010 | buffers which have very long lines. */ | ||
| 9011 | while (nlines-- && IT_CHARPOS (*it) > pos_limit) | ||
| 9006 | back_to_previous_visible_line_start (it); | 9012 | back_to_previous_visible_line_start (it); |
| 9007 | 9013 | ||
| 9008 | /* Reseat the iterator here. When moving backward, we don't want | 9014 | /* Reseat the iterator here. When moving backward, we don't want |
| @@ -9233,6 +9239,9 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos) | |||
| 9233 | struct it it2; | 9239 | struct it it2; |
| 9234 | void *it2data = NULL; | 9240 | void *it2data = NULL; |
| 9235 | ptrdiff_t start_charpos, i; | 9241 | ptrdiff_t start_charpos, i; |
| 9242 | int nchars_per_row | ||
| 9243 | = (it->last_visible_x - it->first_visible_x) / FRAME_COLUMN_WIDTH (it->f); | ||
| 9244 | ptrdiff_t pos_limit; | ||
| 9236 | 9245 | ||
| 9237 | /* Start at the beginning of the screen line containing IT's | 9246 | /* Start at the beginning of the screen line containing IT's |
| 9238 | position. This may actually move vertically backwards, | 9247 | position. This may actually move vertically backwards, |
| @@ -9241,9 +9250,11 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos) | |||
| 9241 | move_it_vertically_backward (it, 0); | 9250 | move_it_vertically_backward (it, 0); |
| 9242 | dvpos -= it->vpos; | 9251 | dvpos -= it->vpos; |
| 9243 | 9252 | ||
| 9244 | /* Go back -DVPOS visible lines and reseat the iterator there. */ | 9253 | /* Go back -DVPOS buffer lines, but no farther than -DVPOS full |
| 9254 | screen lines, and reseat the iterator there. */ | ||
| 9245 | start_charpos = IT_CHARPOS (*it); | 9255 | start_charpos = IT_CHARPOS (*it); |
| 9246 | for (i = -dvpos; i > 0 && IT_CHARPOS (*it) > BEGV; --i) | 9256 | pos_limit = max (start_charpos + dvpos * nchars_per_row, BEGV); |
| 9257 | for (i = -dvpos; i > 0 && IT_CHARPOS (*it) > pos_limit; --i) | ||
| 9247 | back_to_previous_visible_line_start (it); | 9258 | back_to_previous_visible_line_start (it); |
| 9248 | reseat (it, it->current.pos, 1); | 9259 | reseat (it, it->current.pos, 1); |
| 9249 | 9260 | ||