Fusing two identical functions into one: need_screen_update().
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5207 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
455a918071
commit
7edd350593
|
@ -1,3 +1,7 @@
|
|||
2015-04-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (need_horizontal_update, need_vertical_update): Fuse
|
||||
two identical functions into one: need_screen_update().
|
||||
|
||||
2015-04-18 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/global.c, src/nano.c, doc/man/nanorc.5, doc/texinfo/nano.texi:
|
||||
Make the descriptions of the multibuffer feature more accurate.
|
||||
|
|
12
src/move.c
12
src/move.c
|
@ -471,7 +471,7 @@ void do_home(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@ void do_end(void)
|
|||
openfile->current_x = strlen(openfile->current->data);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ void do_up(
|
|||
* needs to be redrawn if we're not on the first page, and the
|
||||
* latter needs to be drawn unconditionally. */
|
||||
if (openfile->current_y > 0) {
|
||||
if (need_vertical_update(0))
|
||||
if (need_screen_update(0))
|
||||
update_line(openfile->current->next, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ void do_down(
|
|||
|| ISSET(SOFTWRAP)
|
||||
#endif
|
||||
) {
|
||||
if (need_vertical_update(0))
|
||||
if (need_screen_update(0))
|
||||
update_line(openfile->current->prev, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ void do_left(void)
|
|||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
|
@ -692,6 +692,6 @@ void do_right(void)
|
|||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
if (need_horizontal_update(pww_save))
|
||||
if (need_screen_update(pww_save))
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
|
|
@ -789,8 +789,7 @@ void reset_cursor(void);
|
|||
void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
line, size_t start);
|
||||
int update_line(filestruct *fileptr, size_t index);
|
||||
bool need_horizontal_update(size_t pww_save);
|
||||
bool need_vertical_update(size_t pww_save);
|
||||
bool need_screen_update(size_t pww_save);
|
||||
void edit_scroll(scroll_dir direction, ssize_t nlines);
|
||||
void edit_redraw(filestruct *old_current, size_t pww_save);
|
||||
void edit_refresh(void);
|
||||
|
|
29
src/winio.c
29
src/winio.c
|
@ -2949,23 +2949,10 @@ int update_line(filestruct *fileptr, size_t index)
|
|||
return extralinesused;
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving horizontally, and FALSE
|
||||
* otherwise. We need one if the mark is on or if pww_save and
|
||||
* placewewant are on different pages. */
|
||||
bool need_horizontal_update(size_t pww_save)
|
||||
{
|
||||
return
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set ||
|
||||
#endif
|
||||
get_page_start(pww_save) !=
|
||||
get_page_start(openfile->placewewant);
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving vertically, and FALSE
|
||||
* otherwise. We need one if the mark is on or if pww_save and
|
||||
* placewewant are on different pages. */
|
||||
bool need_vertical_update(size_t pww_save)
|
||||
/* Return TRUE if we need an update after moving the cursor, and
|
||||
* FALSE otherwise. We need an update if the mark is on, or if
|
||||
* pww_save and placewewant are on different pages. */
|
||||
bool need_screen_update(size_t pww_save)
|
||||
{
|
||||
return
|
||||
#ifndef NANO_TINY
|
||||
|
@ -3012,15 +2999,12 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
|||
{
|
||||
ssize_t i;
|
||||
filestruct *foo;
|
||||
bool do_redraw = FALSE;
|
||||
bool do_redraw = need_screen_update(0);
|
||||
|
||||
/* Don't bother scrolling less than one line. */
|
||||
if (nlines < 1)
|
||||
return;
|
||||
|
||||
if (need_vertical_update(0))
|
||||
do_redraw = TRUE;
|
||||
|
||||
/* Part 1: nlines is the number of lines we're going to scroll the
|
||||
* text of the edit window. */
|
||||
|
||||
|
@ -3122,9 +3106,8 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
|||
* updated. Use this if we've moved without changing any text. */
|
||||
void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
{
|
||||
bool do_redraw = need_vertical_update(0) ||
|
||||
need_vertical_update(pww_save);
|
||||
filestruct *foo = NULL;
|
||||
bool do_redraw = need_screen_update(0) || need_screen_update(pww_save);
|
||||
|
||||
/* If either old_current or current is offscreen, scroll the edit
|
||||
* window until it's onscreen and get out. */
|
||||
|
|
Loading…
Reference in New Issue