diff options
| author | Eli Zaretskii | 2017-07-01 10:22:45 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-07-01 10:22:45 +0300 |
| commit | fb62728b7afa7024d4ca01e6f89b0267231cf607 (patch) | |
| tree | 599ebaebe67ae4bcbc914062112f0f214af764aa /src | |
| parent | 1174e53ebb9610dc352c4a5c533d24c935cc1ed9 (diff) | |
| download | emacs-fb62728b7afa7024d4ca01e6f89b0267231cf607.tar.gz emacs-fb62728b7afa7024d4ca01e6f89b0267231cf607.zip | |
Avoid slow redisplay under 'visual' mode of line numbers
* src/xdisp.c (display_count_lines_visually): Avoid very slow
redisplay when this function is invoked very far from point.
Reported by Alex <agrambot@gmail.com>.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index aeccac2cb16..7bbe9d9ca3e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20783,7 +20783,14 @@ display_count_lines_visually (struct it *it) | |||
| 20783 | /* Need to disable visual mode temporarily, since otherwise the | 20783 | /* Need to disable visual mode temporarily, since otherwise the |
| 20784 | call to move_it_to will cause infinite recursion. */ | 20784 | call to move_it_to will cause infinite recursion. */ |
| 20785 | specbind (Qdisplay_line_numbers, Qrelative); | 20785 | specbind (Qdisplay_line_numbers, Qrelative); |
| 20786 | move_it_to (&tem_it, to, -1, -1, -1, MOVE_TO_POS); | 20786 | /* Some redisplay optimizations could invoke us very far from |
| 20787 | PT, which will make the caller painfully slow. There should | ||
| 20788 | be no need to go too far beyond the window's bottom, as any | ||
| 20789 | such optimization will fail to show point anyway. */ | ||
| 20790 | move_it_to (&tem_it, to, -1, | ||
| 20791 | tem_it.last_visible_y | ||
| 20792 | + (SCROLL_LIMIT + 10) * FRAME_LINE_HEIGHT (tem_it.f), | ||
| 20793 | -1, MOVE_TO_POS | MOVE_TO_Y); | ||
| 20787 | unbind_to (count, Qnil); | 20794 | unbind_to (count, Qnil); |
| 20788 | return IT_CHARPOS (*it) <= PT ? -tem_it.vpos : tem_it.vpos; | 20795 | return IT_CHARPOS (*it) <= PT ? -tem_it.vpos : tem_it.vpos; |
| 20789 | } | 20796 | } |