tweaks: rename a function to better describe what it does

It does not update anything -- it just picks a new point from
where to start displaying the buffer.  All actual updating of
the screen is done by edit_refresh() and edit_redraw() and such.
This commit is contained in:
Benno Schulenberg 2016-10-20 21:11:11 +02:00
parent 3ed5ddba31
commit 01bbf7e82f
6 changed files with 15 additions and 15 deletions

View File

@ -99,7 +99,7 @@ void do_page_up(void)
#endif
/* Scroll the edit window up a page. */
edit_update(STATIONARY);
adjust_viewport(STATIONARY);
refresh_needed = TRUE;
}
@ -139,7 +139,7 @@ void do_page_down(void)
openfile->placewewant);
/* Scroll the edit window down a page. */
edit_update(STATIONARY);
adjust_viewport(STATIONARY);
refresh_needed = TRUE;
}
@ -369,7 +369,7 @@ void ensure_line_is_visible(void)
#ifndef NANO_TINY
if (ISSET(SOFTWRAP) && strlenpt(openfile->current->data) / editwincols +
openfile->current_y >= editwinrows) {
edit_update(ISSET(SMOOTH_SCROLL) ? FLOWING : CENTERING);
adjust_viewport(ISSET(SMOOTH_SCROLL) ? FLOWING : CENTERING);
refresh_needed = TRUE;
}
#endif

View File

@ -395,7 +395,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
/* If the top of the edit window was inside the old partition, put
* it in range of current. */
if (edittop_inside) {
edit_update(STATIONARY);
adjust_viewport(STATIONARY);
refresh_needed = TRUE;
}

View File

@ -781,7 +781,7 @@ bool need_horizontal_scroll(const size_t old_column, const size_t new_column);
void edit_scroll(scroll_dir direction, ssize_t nlines);
void edit_redraw(filestruct *old_current);
void edit_refresh(void);
void edit_update(update_type location);
void adjust_viewport(update_type location);
void total_redraw(void);
void total_refresh(void);
void display_main_list(void);

View File

@ -943,8 +943,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
/* When the position was manually given, center the target line. */
if (interactive || ISSET(SOFTWRAP)) {
edit_update(CENTERING);
edit_refresh();
adjust_viewport(CENTERING);
refresh_needed = TRUE;
} else {
/* If the target line is close to the tail of the file, put the last
* line of the file on the bottom line of the screen; otherwise, just
@ -953,9 +953,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
editwinrows / 2) {
openfile->current_y = editwinrows - openfile->filebot->lineno +
openfile->current->lineno - 1;
edit_update(STATIONARY);
adjust_viewport(STATIONARY);
} else
edit_update(CENTERING);
adjust_viewport(CENTERING);
}
}

View File

@ -3076,7 +3076,7 @@ const char *do_alt_speller(char *tempfile_name)
goto_line_posx(lineno_save, current_x_save);
openfile->current_y = current_y_save;
openfile->placewewant = pww_save;
edit_update(STATIONARY);
adjust_viewport(STATIONARY);
/* Stat the temporary file again, and mark the buffer as modified only
* if this file was changed since it was written. */
@ -3552,7 +3552,7 @@ void do_formatter(void)
goto_line_posx(lineno_save, current_x_save);
openfile->current_y = current_y_save;
openfile->placewewant = pww_save;
edit_update(STATIONARY);
adjust_viewport(STATIONARY);
set_modified();

View File

@ -2899,7 +2899,7 @@ void edit_redraw(filestruct *old_current)
ISSET(SOFTWRAP) && strlenpt(openfile->current->data) >= editwincols) ||
#endif
openfile->current->lineno < openfile->edittop->lineno) {
edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : FLOWING);
adjust_viewport((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : FLOWING);
refresh_needed = TRUE;
}
@ -2948,7 +2948,7 @@ void edit_refresh(void)
#endif
/* Make sure the current line is on the screen. */
edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : STATIONARY);
adjust_viewport((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTERING : STATIONARY);
}
foo = openfile->edittop;
@ -2978,7 +2978,7 @@ void edit_refresh(void)
* middle of the screen, STATIONARY means that it should stay at the
* same vertical position, and FLOWING means that it should scroll no
* more than needed to bring current into view. */
void edit_update(update_type manner)
void adjust_viewport(update_type manner)
{
int goal = 0;
@ -3023,7 +3023,7 @@ void edit_update(update_type manner)
#endif
}
#ifdef DEBUG
fprintf(stderr, "edit_update(): setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
fprintf(stderr, "adjust_viewport(): setting edittop to lineno %ld\n", (long)openfile->edittop->lineno);
#endif
compute_maxrows();
}