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