screen: repaint the edit window in a single place -- the main loop

Instead of doing this in two places: after interpreting shortcuts,
and after injecting characters.
master
Benno Schulenberg 2016-10-21 13:52:40 +02:00
parent 4d996e4c39
commit 2789bb0813
3 changed files with 15 additions and 18 deletions

View File

@ -567,8 +567,7 @@ void display_buffer(void)
precalc_multicolorinfo();
#endif
/* Update the edit window. */
edit_refresh();
refresh_needed = TRUE;
}
#ifndef DISABLE_MULTIBUFFER

View File

@ -1428,7 +1428,7 @@ void do_toggle(int flag)
case LINE_NUMBERS:
#endif
case SOFTWRAP:
edit_refresh();
refresh_needed = TRUE;
break;
}
@ -1733,13 +1733,7 @@ int do_input(bool allow_funcs)
if (f && !f->viewok)
reset_multis(openfile->current, FALSE);
#endif
if (refresh_needed) {
#ifdef DEBUG
fprintf(stderr, "running edit_refresh() as refresh_needed is true\n");
#endif
edit_refresh();
refresh_needed = FALSE;
} else if (s->scfunc == do_delete || s->scfunc == do_backspace)
if (!refresh_needed && (s->scfunc == do_delete || s->scfunc == do_backspace))
update_line(openfile->current, openfile->current_x);
}
}
@ -1956,10 +1950,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
reset_multis(openfile->current, FALSE);
#endif
if (refresh_needed == TRUE) {
edit_refresh();
refresh_needed = FALSE;
} else
if (!refresh_needed)
update_line(openfile->current, openfile->current_x);
}
@ -2718,10 +2709,14 @@ int main(int argc, char **argv)
/* Forget any earlier statusbar x position. */
reinit_statusbar_x();
/* Place the cursor in the edit window and make it visible. */
reset_cursor();
curs_set(1);
wnoutrefresh(edit);
/* Refresh either the entire edit window or just the cursor. */
if (refresh_needed)
edit_refresh();
else {
reset_cursor();
curs_set(1);
wnoutrefresh(edit);
}
/* Read in and interpret keystrokes. */
do_input(TRUE);

View File

@ -2978,7 +2978,10 @@ void edit_refresh(void)
blank_line(edit, nlines, 0, COLS);
reset_cursor();
curs_set(1);
wnoutrefresh(edit);
refresh_needed = FALSE;
}
/* Move edittop so that current is on the screen. manner says how it