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.
This commit is contained in:
@@ -567,8 +567,7 @@ void display_buffer(void)
|
|||||||
precalc_multicolorinfo();
|
precalc_multicolorinfo();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Update the edit window. */
|
refresh_needed = TRUE;
|
||||||
edit_refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_MULTIBUFFER
|
#ifndef DISABLE_MULTIBUFFER
|
||||||
|
|||||||
27
src/nano.c
27
src/nano.c
@@ -1428,7 +1428,7 @@ void do_toggle(int flag)
|
|||||||
case LINE_NUMBERS:
|
case LINE_NUMBERS:
|
||||||
#endif
|
#endif
|
||||||
case SOFTWRAP:
|
case SOFTWRAP:
|
||||||
edit_refresh();
|
refresh_needed = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1733,13 +1733,7 @@ int do_input(bool allow_funcs)
|
|||||||
if (f && !f->viewok)
|
if (f && !f->viewok)
|
||||||
reset_multis(openfile->current, FALSE);
|
reset_multis(openfile->current, FALSE);
|
||||||
#endif
|
#endif
|
||||||
if (refresh_needed) {
|
if (!refresh_needed && (s->scfunc == do_delete || s->scfunc == do_backspace))
|
||||||
#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)
|
|
||||||
update_line(openfile->current, openfile->current_x);
|
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);
|
reset_multis(openfile->current, FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (refresh_needed == TRUE) {
|
if (!refresh_needed)
|
||||||
edit_refresh();
|
|
||||||
refresh_needed = FALSE;
|
|
||||||
} else
|
|
||||||
update_line(openfile->current, openfile->current_x);
|
update_line(openfile->current, openfile->current_x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2718,10 +2709,14 @@ int main(int argc, char **argv)
|
|||||||
/* Forget any earlier statusbar x position. */
|
/* Forget any earlier statusbar x position. */
|
||||||
reinit_statusbar_x();
|
reinit_statusbar_x();
|
||||||
|
|
||||||
/* Place the cursor in the edit window and make it visible. */
|
/* Refresh either the entire edit window or just the cursor. */
|
||||||
reset_cursor();
|
if (refresh_needed)
|
||||||
curs_set(1);
|
edit_refresh();
|
||||||
wnoutrefresh(edit);
|
else {
|
||||||
|
reset_cursor();
|
||||||
|
curs_set(1);
|
||||||
|
wnoutrefresh(edit);
|
||||||
|
}
|
||||||
|
|
||||||
/* Read in and interpret keystrokes. */
|
/* Read in and interpret keystrokes. */
|
||||||
do_input(TRUE);
|
do_input(TRUE);
|
||||||
|
|||||||
@@ -2978,7 +2978,10 @@ void edit_refresh(void)
|
|||||||
blank_line(edit, nlines, 0, COLS);
|
blank_line(edit, nlines, 0, COLS);
|
||||||
|
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
|
curs_set(1);
|
||||||
wnoutrefresh(edit);
|
wnoutrefresh(edit);
|
||||||
|
|
||||||
|
refresh_needed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move edittop so that current is on the screen. manner says how it
|
/* Move edittop so that current is on the screen. manner says how it
|
||||||
|
|||||||
Reference in New Issue
Block a user