[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-zile] [PATCH] refactor: redisplay only when there's no typeahead bu
From: |
Gary V. Vaughan |
Subject: |
[Bug-zile] [PATCH] refactor: redisplay only when there's no typeahead buffered. |
Date: |
Sun, 27 May 2012 21:11:53 +0700 |
From: "Gary V. Vaughan" <address@hidden>
Preliminary patch to cut time spent catching up with typeahead
by 90% or so.
Before committing, it would be nice to find why the display always
shows just the last half-dozen lines of any large paste at the top
of the window, where prior to this patch that is not always the
case...
* src/main.c (main): don't redisplay after every key command.
* src/getkey.c (getkey): do redisplay if there are no keys left
in the typeahead buffer.
---
src/getkey.c | 11 ++++++++++-
src/main.c | 6 ------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/getkey.c b/src/getkey.c
index 0eafb72..130e60f 100644
--- a/src/getkey.c
+++ b/src/getkey.c
@@ -42,7 +42,16 @@ lastkey (void)
size_t
getkey (int mode)
{
- _last_key = term_getkey (mode);
+ _last_key = term_getkey (0);
+
+ if (_last_key == KBD_NOKEY)
+ {
+ if (lastflag & FLAG_NEED_RESYNC)
+ resync_redisplay (cur_wp);
+ term_redisplay ();
+ term_refresh ();
+ _last_key = term_getkey (mode);
+ }
if (thisflag & FLAG_DEFINING_MACRO)
add_key_to_cmd (_last_key);
diff --git a/src/main.c b/src/main.c
index 08eb065..ab2173b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -336,13 +336,7 @@ main (int argc, char **argv)
/* Run the main loop. */
while (!(thisflag & FLAG_QUIT))
- {
- if (lastflag & FLAG_NEED_RESYNC)
- resync_redisplay (cur_wp);
- term_redisplay ();
- term_refresh ();
get_and_run_command ();
- }
/* Tidy and close the terminal. */
term_finish ();
--
1.7.10.2
- [Bug-zile] [PATCH] refactor: redisplay only when there's no typeahead buffered.,
Gary V. Vaughan <=