nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 01bbf7e82f895cc9f7ca4e61d861048d25a1c4c1
parent 3ed5ddba31ea80d7fa134eb36ff03f87e046c6f5
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Thu, 20 Oct 2016 21:11:11 +0200

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.

Diffstat:
Msrc/move.c | 6+++---
Msrc/nano.c | 2+-
Msrc/proto.h | 2+-
Msrc/search.c | 8++++----
Msrc/text.c | 4++--
Msrc/winio.c | 8++++----
6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/move.c b/src/move.c @@ -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 diff --git a/src/nano.c b/src/nano.c @@ -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; } diff --git a/src/proto.h b/src/proto.h @@ -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); diff --git a/src/search.c b/src/search.c @@ -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); } } diff --git a/src/text.c b/src/text.c @@ -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(); diff --git a/src/winio.c b/src/winio.c @@ -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(); }