const filestruct *current_save = openfile->current;
size_t pww_save = openfile->placewewant;
+ check_statusblank();
+
openfile->current = openfile->fileage;
openfile->current_x = 0;
openfile->placewewant = 0;
const filestruct *current_save = openfile->current;
size_t pww_save = openfile->placewewant;
+ check_statusblank();
+
openfile->current = openfile->filebot;
openfile->current_x = 0;
openfile->placewewant = 0;
{
size_t pww_save = openfile->placewewant;
+ check_statusblank();
+
#ifndef NANO_SMALL
if (ISSET(SMART_HOME)) {
size_t current_x_save = openfile->current_x;
}
#endif
- check_statusblank();
-
if (need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
{
size_t pww_save = openfile->placewewant;
+ check_statusblank();
+
openfile->current_x = strlen(openfile->current->data);
openfile->placewewant = xplustabs();
- check_statusblank();
-
if (need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
void do_page_up(void)
{
+ int i;
+
+ check_statusblank();
+
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the first line of the file, and then
* update the edit window. */
- if (openfile->current->lineno <= editwinrows - 2)
+ if (openfile->current->lineno <= editwinrows - 2) {
do_first_line();
- else {
- int i;
+ return;
+ }
- /* If we're not in smooth scrolling mode, put the cursor at the
- * beginning of the top line of the edit window, as Pico
- * does. */
+ /* If we're not in smooth scrolling mode, put the cursor at the
+ * beginning of the top line of the edit window, as Pico does. */
#ifndef NANO_SMALL
- if (!ISSET(SMOOTH_SCROLL)) {
+ if (!ISSET(SMOOTH_SCROLL)) {
#endif
- openfile->current = openfile->edittop;
- openfile->placewewant = 0;
+ openfile->current = openfile->edittop;
+ openfile->placewewant = 0;
#ifndef NANO_SMALL
- }
+ }
#endif
- for (i = editwinrows - 2; i > 0 && openfile->current->prev !=
- NULL; i--)
- openfile->current = openfile->current->prev;
+ for (i = editwinrows - 2; i > 0 && openfile->current->prev != NULL;
+ i--)
+ openfile->current = openfile->current->prev;
- openfile->current_x = actual_x(openfile->current->data,
- openfile->placewewant);
-
- /* Scroll the edit window up a page. */
- edit_scroll(UP, editwinrows - 2);
- }
+ openfile->current_x = actual_x(openfile->current->data,
+ openfile->placewewant);
- check_statusblank();
+ /* Scroll the edit window up a page. */
+ edit_scroll(UP, editwinrows - 2);
}
void do_page_down(void)
{
+ int i;
+
+ check_statusblank();
+
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
* cursor at the beginning of the last line of the file, and then
* update the edit window. */
if (openfile->current->lineno + editwinrows - 2 >=
- openfile->filebot->lineno)
+ openfile->filebot->lineno) {
do_last_line();
- else {
- /* If we're not in smooth scrolling mode, put the cursor at the
- * beginning of the top line of the edit window, as Pico
- * does. */
- int i;
+ return;
+ }
+ /* If we're not in smooth scrolling mode, put the cursor at the
+ * beginning of the top line of the edit window, as Pico does. */
#ifndef NANO_SMALL
- if (!ISSET(SMOOTH_SCROLL)) {
+ if (!ISSET(SMOOTH_SCROLL)) {
#endif
- openfile->current = openfile->edittop;
- openfile->placewewant = 0;
+ openfile->current = openfile->edittop;
+ openfile->placewewant = 0;
#ifndef NANO_SMALL
- }
+ }
#endif
- for (i = editwinrows - 2; i > 0 && openfile->current->next !=
- NULL; i--)
- openfile->current = openfile->current->next;
+ for (i = editwinrows - 2; i > 0 && openfile->current->next != NULL;
+ i--)
+ openfile->current = openfile->current->next;
- openfile->current_x = actual_x(openfile->current->data,
- openfile->placewewant);
-
- /* Scroll the edit window down a page. */
- edit_scroll(DOWN, editwinrows - 2);
- }
+ openfile->current_x = actual_x(openfile->current->data,
+ openfile->placewewant);
- check_statusblank();
+ /* Scroll the edit window down a page. */
+ edit_scroll(DOWN, editwinrows - 2);
}
void do_up(void)
{
+ check_statusblank();
+
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
- check_statusblank();
/* If we're at the top of the file, get out. */
if (openfile->current->prev == NULL)
void do_down(void)
{
+ check_statusblank();
+
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
- check_statusblank();
/* If we're at the bottom of the file, get out. */
if (openfile->current->next == NULL)
{
size_t pww_save = openfile->placewewant;
+ check_statusblank();
+
if (openfile->current_x > 0)
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
openfile->placewewant = xplustabs();
- check_statusblank();
-
if (allow_update && need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}
{
size_t pww_save = openfile->placewewant;
+ check_statusblank();
+
assert(openfile->current_x <= strlen(openfile->current->data));
if (openfile->current->data[openfile->current_x] != '\0')
openfile->placewewant = xplustabs();
- check_statusblank();
-
if (allow_update && need_horizontal_update(pww_save))
update_line(openfile->current, openfile->current_x);
}