diff options
| author | Eli Zaretskii | 2017-07-18 19:13:58 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-07-18 19:13:58 +0300 |
| commit | c2049489090141311bf8f460bf366d9784950861 (patch) | |
| tree | 62b4d82b13cbe427ee2afa5c4f2a7cadbfed2ca7 /src | |
| parent | 3d432a180b3ac867d1d028af17cee14d481cfc01 (diff) | |
| download | emacs-c2049489090141311bf8f460bf366d9784950861.tar.gz emacs-c2049489090141311bf8f460bf366d9784950861.zip | |
Avoid infloop due to Eshell's "smart" redisplay
* src/xdisp.c (pos_visible_p): Save and restore the window's
mode-line and header-line height. (Bug#27752)
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index a3bc5a5fccd..c415bf2131f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1326,6 +1326,15 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1326 | if (charpos >= 0 && CHARPOS (top) > charpos) | 1326 | if (charpos >= 0 && CHARPOS (top) > charpos) |
| 1327 | return visible_p; | 1327 | return visible_p; |
| 1328 | 1328 | ||
| 1329 | /* Some Lisp hook could call us in the middle of redisplaying this | ||
| 1330 | very window. If, by some bad luck, we are retrying redisplay | ||
| 1331 | because we found that the mode-line height and/or header-line | ||
| 1332 | height needs to be updated, the assignment of mode_line_height | ||
| 1333 | and header_line_height below could disrupt that, due to the | ||
| 1334 | selected/nonselected window dance during mode-line display, and | ||
| 1335 | we could infloop. Avoid that. */ | ||
| 1336 | int prev_mode_line_height = w->mode_line_height; | ||
| 1337 | int prev_header_line_height = w->header_line_height; | ||
| 1329 | /* Compute exact mode line heights. */ | 1338 | /* Compute exact mode line heights. */ |
| 1330 | if (window_wants_mode_line (w)) | 1339 | if (window_wants_mode_line (w)) |
| 1331 | { | 1340 | { |
| @@ -1672,6 +1681,10 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, | |||
| 1672 | fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll); | 1681 | fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll); |
| 1673 | #endif | 1682 | #endif |
| 1674 | 1683 | ||
| 1684 | /* Restore potentially overwritten values. */ | ||
| 1685 | w->mode_line_height = prev_mode_line_height; | ||
| 1686 | w->header_line_height = prev_header_line_height; | ||
| 1687 | |||
| 1675 | return visible_p; | 1688 | return visible_p; |
| 1676 | } | 1689 | } |
| 1677 | 1690 | ||