From a268abc3d1b980a4a19a7275108287dc3ce1e492 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 1 Nov 2018 07:05:08 -0700 Subject: 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. --- linenoise/linenoise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linenoise') 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); -- cgit v1.2.3