screen: don't always set 'edit_refresh_needed' when adjusting edittop
The function edit_update() is called by edit_refresh() itself, so it is silly that the first sets 'edit_refresh_needed' to TRUE. This setting is needed only in a few cases -- in the others it's not needed because the screen does not need to be refreshed (it was just about positioning the cursor), or 'edit_refresh_needed' has already been set by a call to goto_line_posx(). So, just set the flag in the five places that need it and spare the other four calls.master
parent
3e1d2b9049
commit
b97c36c218
|
@ -1262,9 +1262,6 @@ void do_insertfile(
|
||||||
|
|
||||||
#ifndef DISABLE_MULTIBUFFER
|
#ifndef DISABLE_MULTIBUFFER
|
||||||
if (ISSET(MULTIBUFFER)) {
|
if (ISSET(MULTIBUFFER)) {
|
||||||
/* Update the screen to account for the current buffer. */
|
|
||||||
display_buffer();
|
|
||||||
|
|
||||||
#ifndef DISABLE_HISTORIES
|
#ifndef DISABLE_HISTORIES
|
||||||
if (ISSET(POS_HISTORY)) {
|
if (ISSET(POS_HISTORY)) {
|
||||||
ssize_t priorline, priorcol;
|
ssize_t priorline, priorcol;
|
||||||
|
@ -1275,6 +1272,8 @@ void do_insertfile(
|
||||||
do_gotolinecolumn(priorline, priorcol, FALSE, FALSE);
|
do_gotolinecolumn(priorline, priorcol, FALSE, FALSE);
|
||||||
}
|
}
|
||||||
#endif /* !DISABLE_HISTORIES */
|
#endif /* !DISABLE_HISTORIES */
|
||||||
|
/* Update the screen to account for the current buffer. */
|
||||||
|
display_buffer();
|
||||||
} else
|
} else
|
||||||
#endif /* !DISABLE_MULTIBUFFER */
|
#endif /* !DISABLE_MULTIBUFFER */
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,7 @@ void do_page_up(void)
|
||||||
|
|
||||||
/* Scroll the edit window up a page. */
|
/* Scroll the edit window up a page. */
|
||||||
edit_update(STATIONARY);
|
edit_update(STATIONARY);
|
||||||
|
edit_refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move down one page. */
|
/* Move down one page. */
|
||||||
|
@ -137,6 +138,7 @@ void do_page_down(void)
|
||||||
|
|
||||||
/* Scroll the edit window down a page. */
|
/* Scroll the edit window down a page. */
|
||||||
edit_update(STATIONARY);
|
edit_update(STATIONARY);
|
||||||
|
edit_refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
|
|
|
@ -403,8 +403,10 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||||
|
|
||||||
/* If the top of the edit window was inside the old partition, put
|
/* If the top of the edit window was inside the old partition, put
|
||||||
* it in range of current. */
|
* it in range of current. */
|
||||||
if (edittop_inside)
|
if (edittop_inside) {
|
||||||
edit_update(STATIONARY);
|
edit_update(STATIONARY);
|
||||||
|
edit_refresh_needed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Renumber starting with the beginning line of the old
|
/* Renumber starting with the beginning line of the old
|
||||||
* partition. */
|
* partition. */
|
||||||
|
|
|
@ -242,6 +242,7 @@ int search_init(bool replacing, bool use_answer)
|
||||||
} else if (func == do_gotolinecolumn_void) {
|
} else if (func == do_gotolinecolumn_void) {
|
||||||
do_gotolinecolumn(openfile->current->lineno,
|
do_gotolinecolumn(openfile->current->lineno,
|
||||||
openfile->placewewant + 1, TRUE, TRUE);
|
openfile->placewewant + 1, TRUE, TRUE);
|
||||||
|
edit_refresh_needed = TRUE;
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2954,8 +2954,10 @@ void edit_redraw(filestruct *old_current)
|
||||||
|
|
||||||
/* If the current line is offscreen, scroll until it's onscreen. */
|
/* If the current line is offscreen, scroll until it's onscreen. */
|
||||||
if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
|
if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
|
||||||
openfile->current->lineno < openfile->edittop->lineno)
|
openfile->current->lineno < openfile->edittop->lineno) {
|
||||||
edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : FLOWING);
|
edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : FLOWING);
|
||||||
|
edit_refresh_needed = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* If the mark is on, update all lines between old_current and current. */
|
/* If the mark is on, update all lines between old_current and current. */
|
||||||
|
@ -3070,7 +3072,6 @@ void edit_update(update_type manner)
|
||||||
fprintf(stderr, "edit_update(): setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
|
fprintf(stderr, "edit_update(): setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
|
||||||
#endif
|
#endif
|
||||||
compute_maxrows();
|
compute_maxrows();
|
||||||
edit_refresh_needed = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unconditionally redraw the entire screen. */
|
/* Unconditionally redraw the entire screen. */
|
||||||
|
|
Loading…
Reference in New Issue