diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-11-01 07:05:08 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-11-01 07:05:08 -0700 |
commit | a268abc3d1b980a4a19a7275108287dc3ce1e492 (patch) | |
tree | b063d0b25187dcc12d85409225d1a6edebddcb59 /linenoise | |
parent | a997f22131a7c98505cebcc88f3badd67a50518d (diff) | |
download | txr-a268abc3d1b980a4a19a7275108287dc3ce1e492.tar.gz txr-a268abc3d1b980a4a19a7275108287dc3ce1e492.tar.bz2 txr-a268abc3d1b980a4a19a7275108287dc3ce1e492.zip |
linenoise: clear need_refresh in refresh_line.
* linenoise/linenoise.c (refresh_line): Clear the need_refresh
flag here.
(edit): No need to clear it here any more. This will prevent
some useless calls to refresh_line. Some edit operations set
refresh_line, but then execute something that performs
refresh_line unconditionally. If the flag is then reset, the
top of the loop doesn't have to do another wasteful refresh.
Diffstat (limited to 'linenoise')
-rw-r--r-- | linenoise/linenoise.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 62a2c31e..93ead695 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -1233,6 +1233,8 @@ static void refresh_line(lino_t *ls) { refresh_multiline(ls); else refresh_singleline(ls); + + ls->need_refresh = 0; } static int scan_match_rev(const wchar_t *s, int i, wchar_t mch) @@ -1949,10 +1951,8 @@ static int edit(lino_t *l, const wchar_t *prompt) update_sel(l); - if (l->need_refresh) { - l->need_refresh = 0; + if (l->need_refresh) refresh_line(l); - } c = lino_os.getch_fn(l->tty_ifs); |