+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.
}
#endif
- if (need_horizontal_update(pww_save))
+ if (need_screen_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
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);
}
* 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);
}
|| 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);
}
openfile->placewewant = xplustabs();
- if (need_horizontal_update(pww_save))
+ if (need_screen_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
openfile->placewewant = xplustabs();
- if (need_horizontal_update(pww_save))
+ if (need_screen_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
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);
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
{
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. */
* 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. */