diff --git a/src/cut.c b/src/cut.c index 0d07a1ad..871ebab3 100644 --- a/src/cut.c +++ b/src/cut.c @@ -223,7 +223,7 @@ void do_copy_text(void) static struct filestruct *next_contiguous_line = NULL; bool mark_set = openfile->mark_set; - /* Remember the current view port and cursor position. */ + /* Remember the current viewport and cursor position. */ ssize_t is_edittop_lineno = openfile->edittop->lineno; ssize_t is_current_lineno = openfile->current->lineno; size_t is_current_x = openfile->current_x; @@ -237,7 +237,7 @@ void do_copy_text(void) next_contiguous_line = (mark_set ? NULL : openfile->current); if (mark_set) { - /* Restore the view port and cursor position. */ + /* Restore the viewport and cursor position. */ openfile->edittop = fsfromline(is_edittop_lineno); openfile->current = fsfromline(is_current_lineno); openfile->current_x = is_current_x; diff --git a/src/move.c b/src/move.c index 3eac79cc..92582609 100644 --- a/src/move.c +++ b/src/move.c @@ -488,11 +488,9 @@ void do_down(bool scroll_only) openfile->current_x = actual_x(openfile->current->data, openfile->placewewant); - /* If scroll_only is FALSE and if we're on the last line of the - * edit window, scroll the edit window down one line if we're in - * smooth scrolling mode, or down half a page if we're not. If - * scroll_only is TRUE, scroll the edit window down one line - * unconditionally. */ + /* When the cursor was on the last line of the edit window (or when just + * scrolling without moving the cursor), scroll the edit window down -- one + * line if we're in smooth scrolling mode, and half a page otherwise. */ #ifndef NANO_TINY if (openfile->current_y == editwinrows - 1 || amount > 0 || scroll_only) { if (amount < 1 || scroll_only) diff --git a/src/winio.c b/src/winio.c index 7b32448e..0aa3c2ce 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2909,8 +2909,8 @@ void edit_redraw(filestruct *old_current) if (old_current != openfile->current && get_page_start(was_pww) > 0) update_line(old_current, 0); - /* Update current if we've changed page, or if it differs from - * old_current and needs to be horizontally scrolled. */ + /* Update current if the mark is on or it has changed "page", or if it + * differs from old_current and needs to be horizontally scrolled. */ if (need_horizontal_scroll(was_pww, openfile->placewewant) || (old_current != openfile->current && get_page_start(openfile->placewewant) > 0)) @@ -2969,15 +2969,14 @@ void adjust_viewport(update_type manner) { int goal = 0; - /* If manner is CENTERING, move edittop half the number of window - * lines back from current. If manner is STATIONARY, move edittop - * back current_y lines if current_y is in range of the screen, - * 0 lines if current_y is below zero, or (editwinrows - 1) lines - * if current_y is too big. This puts current at the same place - * on the screen as before, or at the top or bottom if current_y is - * beyond either. If manner is FLOWING, move edittop back 0 lines - * or (editwinrows - 1) lines, depending or where current has moved. - * This puts the cursor on the first or the last line. */ + /* If manner is CENTERING, move edittop half the number of window rows + * back from current. If manner is FLOWING, move edittop back 0 rows + * or (editwinrows - 1) rows, depending on where current has moved. + * This puts the cursor on the first or the last row. If manner is + * STATIONARY, move edittop back current_y rows if current_y is in range + * of the screen, 0 rows if current_y is below zero, or (editwinrows - 1) + * rows if current_y is too big. This puts current at the same place on + * the screen as before, or... at some undefined place. */ if (manner == CENTERING) goal = editwinrows / 2; else if (manner == FLOWING) { @@ -2991,7 +2990,7 @@ void adjust_viewport(update_type manner) } else { goal = openfile->current_y; - /* Limit goal to (editwinrows - 1) lines maximum. */ + /* Limit goal to (editwinrows - 1) rows maximum. */ if (goal > editwinrows - 1) goal = editwinrows - 1; }