Mercurial > vim
comparison src/screen.c @ 15629:dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
commit https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 25 22:29:57 2019 +0100
patch 8.1.0822: peeking and flushing output slows down execution
Problem: Peeking and flushing output slows down execution.
Solution: Do not update the mode message when global_busy is set. Do not
flush when only peeking for a character. (Ken Takata)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 25 Jan 2019 22:30:13 +0100 |
parents | b440c7becbca |
children | 6f1c7e9a6393 |
comparison
equal
deleted
inserted
replaced
15628:9349b4bef75f | 15629:dd2e0b83a660 |
---|---|
10108 | 10108 |
10109 return OK; | 10109 return OK; |
10110 } | 10110 } |
10111 | 10111 |
10112 /* | 10112 /* |
10113 * Return TRUE when postponing displaying the mode message: when not redrawing | |
10114 * or inside a mapping. | |
10115 */ | |
10116 int | |
10117 skip_showmode() | |
10118 { | |
10119 // Call char_avail() only when we are going to show something, because it | |
10120 // takes a bit of time. redrawing() may also call char_avail_avail(). | |
10121 if (global_busy | |
10122 || msg_silent != 0 | |
10123 || !redrawing() | |
10124 || (char_avail() && !KeyTyped)) | |
10125 { | |
10126 redraw_cmdline = TRUE; // show mode later | |
10127 return TRUE; | |
10128 } | |
10129 return FALSE; | |
10130 } | |
10131 | |
10132 /* | |
10113 * Show the current mode and ruler. | 10133 * Show the current mode and ruler. |
10114 * | 10134 * |
10115 * If clear_cmdline is TRUE, clear the rest of the cmdline. | 10135 * If clear_cmdline is TRUE, clear the rest of the cmdline. |
10116 * If clear_cmdline is FALSE there may be a message there that needs to be | 10136 * If clear_cmdline is FALSE there may be a message there that needs to be |
10117 * cleared only if a mode is shown. | 10137 * cleared only if a mode is shown. |
10133 && ((State & INSERT) | 10153 && ((State & INSERT) |
10134 || restart_edit != NUL | 10154 || restart_edit != NUL |
10135 || VIsual_active)); | 10155 || VIsual_active)); |
10136 if (do_mode || reg_recording != 0) | 10156 if (do_mode || reg_recording != 0) |
10137 { | 10157 { |
10138 /* | 10158 if (skip_showmode()) |
10139 * Don't show mode right now, when not redrawing or inside a mapping. | 10159 return 0; // show mode later |
10140 * Call char_avail() only when we are going to show something, because | |
10141 * it takes a bit of time. | |
10142 */ | |
10143 if (!redrawing() || (char_avail() && !KeyTyped) || msg_silent != 0) | |
10144 { | |
10145 redraw_cmdline = TRUE; /* show mode later */ | |
10146 return 0; | |
10147 } | |
10148 | 10160 |
10149 nwr_save = need_wait_return; | 10161 nwr_save = need_wait_return; |
10150 | 10162 |
10151 /* wait a bit before overwriting an important message */ | 10163 /* wait a bit before overwriting an important message */ |
10152 check_for_delay(FALSE); | 10164 check_for_delay(FALSE); |