Commit 2789bb08 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
parent 4d996e4c
Showing with 15 additions and 18 deletions
+15 -18
......@@ -567,8 +567,7 @@ void display_buffer(void)
precalc_multicolorinfo();
#endif
/* Update the edit window. */
edit_refresh();
refresh_needed = TRUE;
}
#ifndef DISABLE_MULTIBUFFER
......
......@@ -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);
......
......@@ -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
......
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