Commit 6d8e495c authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

remove still more redundant screen updates; change all wrefresh() calls

to wnoutrefresh() calls, except for those in total_update() and
do_credits(); call doupdate() just before using blocking input, since
nano spends the most time using it, for blocking input; and only do
constant sursor position display if we're just about to use blocking
input


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2943 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 31 additions and 25 deletions
+31 -25
...@@ -115,6 +115,16 @@ CVS code - ...@@ -115,6 +115,16 @@ CVS code -
redrawing the screen. Changes to window_init(), main(), and redrawing the screen. Changes to window_init(), main(), and
do_alt_speller(); removal of check_die_too_small() and do_alt_speller(); removal of check_die_too_small() and
window_size_init(). (DLR) window_size_init(). (DLR)
- Remove still more redundant screen updates. Change all
wrefresh() calls to wnoutrefresh() calls, except for those in
total_update() and do_credits(); call doupdate() just before
using blocking input, since nano spends the most time using
it, for blocking input; and only do constant sursor position
display if we're just about to use blocking input. Changes to
input_tab(), do_browser(), finish(), do_output(), main(),
get_key_buffer(), check_statusblank(), nanogetstr(),
titlebar(), statusbar(), bottombars(), edit_refresh(),
do_yesno(), and do_help(). (DLR)
- color.c: - color.c:
- Remove unneeded string.h and fcntl.h includes. (DLR) - Remove unneeded string.h and fcntl.h includes. (DLR)
- chars.c: - chars.c:
......
...@@ -2143,7 +2143,7 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list) ...@@ -2143,7 +2143,7 @@ char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list)
editline++; editline++;
} }
wrefresh(edit); wnoutrefresh(edit);
*list = TRUE; *list = TRUE;
} }
...@@ -2266,7 +2266,7 @@ char *do_browser(char *path, DIR *dir) ...@@ -2266,7 +2266,7 @@ char *do_browser(char *path, DIR *dir)
curs_set(0); curs_set(0);
blank_statusbar(); blank_statusbar();
bottombars(browser_list); bottombars(browser_list);
wrefresh(bottomwin); wnoutrefresh(bottomwin);
#if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE) #if !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
/* Set currshortcut so the user can click in the shortcut area, and /* Set currshortcut so the user can click in the shortcut area, and
...@@ -2612,7 +2612,7 @@ char *do_browser(char *path, DIR *dir) ...@@ -2612,7 +2612,7 @@ char *do_browser(char *path, DIR *dir)
free(foo); free(foo);
} }
wrefresh(edit); wnoutrefresh(edit);
} while ((kbinput = get_kbinput(edit, &meta_key, &func_key)) != } while ((kbinput = get_kbinput(edit, &meta_key, &func_key)) !=
NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY); NANO_EXIT_KEY && kbinput != NANO_EXIT_FKEY);
......
...@@ -526,7 +526,7 @@ void finish(void) ...@@ -526,7 +526,7 @@ void finish(void)
else else
blank_statusbar(); blank_statusbar();
wrefresh(bottomwin); wnoutrefresh(bottomwin);
endwin(); endwin();
/* Restore the old terminal settings. */ /* Restore the old terminal settings. */
...@@ -1748,7 +1748,6 @@ bool do_mouse(void) ...@@ -1748,7 +1748,6 @@ bool do_mouse(void)
void do_output(char *output, size_t output_len, bool allow_cntrls) void do_output(char *output, size_t output_len, bool allow_cntrls)
{ {
size_t current_len, i = 0; size_t current_len, i = 0;
bool old_const_update = ISSET(CONST_UPDATE);
bool do_refresh = FALSE; bool do_refresh = FALSE;
/* Do we have to call edit_refresh(), or can we get away with /* Do we have to call edit_refresh(), or can we get away with
* update_line()? */ * update_line()? */
...@@ -1760,9 +1759,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) ...@@ -1760,9 +1759,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
current_len = strlen(openfile->current->data); current_len = strlen(openfile->current->data);
/* Turn off constant cursor position display. */
UNSET(CONST_UPDATE);
while (i < output_len) { while (i < output_len) {
/* If allow_cntrls is FALSE, filter out nulls and newlines, /* If allow_cntrls is FALSE, filter out nulls and newlines,
* since they're control characters. */ * since they're control characters. */
...@@ -1840,11 +1836,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) ...@@ -1840,11 +1836,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#endif #endif
} }
/* Turn constant cursor position display back on if it was on
* before. */
if (old_const_update)
SET(CONST_UPDATE);
free(char_buf); free(char_buf);
openfile->placewewant = xplustabs(); openfile->placewewant = xplustabs();
...@@ -2404,9 +2395,10 @@ int main(int argc, char **argv) ...@@ -2404,9 +2395,10 @@ int main(int argc, char **argv)
/* Make sure the cursor is in the edit window. */ /* Make sure the cursor is in the edit window. */
reset_cursor(); reset_cursor();
/* If constant cursor position display is on, display the /* If constant cursor position display is on, and there are no
* current cursor position on the statusbar. */ * keys waiting in the input buffer, display the current cursor
if (ISSET(CONST_UPDATE)) * position on the statusbar. */
if (ISSET(CONST_UPDATE) && get_key_buffer_len() == 0)
do_cursorpos(TRUE); do_cursorpos(TRUE);
currshortcut = main_list; currshortcut = main_list;
......
...@@ -138,6 +138,10 @@ void get_key_buffer(WINDOW *win) ...@@ -138,6 +138,10 @@ void get_key_buffer(WINDOW *win)
allow_pending_sigwinch(TRUE); allow_pending_sigwinch(TRUE);
#endif #endif
/* Just before reading in the first character, display any pending
* screen updates. */
doupdate();
input = wgetch(win); input = wgetch(win);
/* If we get ERR when using blocking input, it means that the input /* If we get ERR when using blocking input, it means that the input
...@@ -2251,7 +2255,7 @@ void check_statusblank(void) ...@@ -2251,7 +2255,7 @@ void check_statusblank(void)
blank_statusbar(); blank_statusbar();
wnoutrefresh(bottomwin); wnoutrefresh(bottomwin);
reset_cursor(); reset_cursor();
wrefresh(edit); wnoutrefresh(edit);
} }
} }
...@@ -2507,7 +2511,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer, ...@@ -2507,7 +2511,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
/* Refresh the edit window and the statusbar before getting /* Refresh the edit window and the statusbar before getting
* input. */ * input. */
wnoutrefresh(edit); wnoutrefresh(edit);
wrefresh(bottomwin); wnoutrefresh(bottomwin);
/* If we're using restricted mode, we aren't allowed to change the /* If we're using restricted mode, we aren't allowed to change the
* name of a file once it has one because that would allow writing * name of a file once it has one because that would allow writing
...@@ -2612,7 +2616,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer, ...@@ -2612,7 +2616,7 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
#endif #endif
nanoget_repaint(buf, answer, statusbar_x); nanoget_repaint(buf, answer, statusbar_x);
wrefresh(bottomwin); wnoutrefresh(bottomwin);
} }
#ifndef NANO_SMALL #ifndef NANO_SMALL
...@@ -2863,7 +2867,7 @@ void titlebar(const char *path) ...@@ -2863,7 +2867,7 @@ void titlebar(const char *path)
wnoutrefresh(topwin); wnoutrefresh(topwin);
reset_cursor(); reset_cursor();
wrefresh(edit); wnoutrefresh(edit);
} }
/* Set the modified flag if it isn't already set, and then update the /* Set the modified flag if it isn't already set, and then update the
...@@ -2926,7 +2930,7 @@ void statusbar(const char *msg, ...) ...@@ -2926,7 +2930,7 @@ void statusbar(const char *msg, ...)
wattroff(bottomwin, A_REVERSE); wattroff(bottomwin, A_REVERSE);
wnoutrefresh(bottomwin); wnoutrefresh(bottomwin);
reset_cursor(); reset_cursor();
wrefresh(edit); wnoutrefresh(edit);
/* Leave the cursor at its position in the edit window, not /* Leave the cursor at its position in the edit window, not
* in the statusbar. */ * in the statusbar. */
} }
...@@ -2993,7 +2997,7 @@ void bottombars(const shortcut *s) ...@@ -2993,7 +2997,7 @@ void bottombars(const shortcut *s)
wnoutrefresh(bottomwin); wnoutrefresh(bottomwin);
reset_cursor(); reset_cursor();
wrefresh(edit); wnoutrefresh(edit);
} }
/* Write a shortcut key to the help area at the bottom of the window. /* Write a shortcut key to the help area at the bottom of the window.
...@@ -3639,7 +3643,7 @@ void edit_refresh(void) ...@@ -3639,7 +3643,7 @@ void edit_refresh(void)
blank_line(edit, nlines, 0, COLS); blank_line(edit, nlines, 0, COLS);
reset_cursor(); reset_cursor();
wrefresh(edit); wnoutrefresh(edit);
} }
/* Move edittop to put it in range of current, keeping current in the /* Move edittop to put it in range of current, keeping current in the
...@@ -3734,7 +3738,7 @@ int do_yesno(bool all, const char *msg) ...@@ -3734,7 +3738,7 @@ int do_yesno(bool all, const char *msg)
/* Refresh the edit window and the statusbar before getting /* Refresh the edit window and the statusbar before getting
* input. */ * input. */
wnoutrefresh(edit); wnoutrefresh(edit);
wrefresh(bottomwin); wnoutrefresh(bottomwin);
do { do {
int kbinput; int kbinput;
...@@ -4011,7 +4015,7 @@ void do_help(void) ...@@ -4011,7 +4015,7 @@ void do_help(void)
if (old_no_help) { if (old_no_help) {
blank_bottombars(); blank_bottombars();
wrefresh(bottomwin); wnoutrefresh(bottomwin);
SET(NO_HELP); SET(NO_HELP);
window_init(); window_init();
} else } else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment