mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 06:09:38 +03:00
scrolling: don't bother to limit the number of lines to step back
The go_back_chunks() function will do this clipping. This fixes https://savannah.gnu.org/bugs/?50866.
This commit is contained in:
parent
ac1444578c
commit
861d81edba
34
src/winio.c
34
src/winio.c
@ -3093,37 +3093,23 @@ void edit_refresh(void)
|
|||||||
refresh_needed = FALSE;
|
refresh_needed = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move edittop so that current is on the screen. manner says how it
|
/* Move edittop so that current is on the screen. manner says how:
|
||||||
* should be moved: CENTERING means that current should end up in the
|
* STATIONARY means that the cursor should stay on the same screen row,
|
||||||
* middle of the screen, STATIONARY means that it should stay at the
|
* CENTERING means that current should end up in the middle of the screen,
|
||||||
* same vertical position, and FLOWING means that it should scroll no
|
* and FLOWING means that it should scroll no more than needed to bring
|
||||||
* more than needed to bring current into view. */
|
* current into view. */
|
||||||
void adjust_viewport(update_type manner)
|
void adjust_viewport(update_type manner)
|
||||||
{
|
{
|
||||||
int goal = 0;
|
int goal = 0;
|
||||||
|
|
||||||
/* If manner is CENTERING, move edittop half the number of window rows
|
if (manner == STATIONARY)
|
||||||
* 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) {
|
|
||||||
if (!current_is_above_screen())
|
|
||||||
goal = editwinrows - 1;
|
|
||||||
} else {
|
|
||||||
goal = openfile->current_y;
|
goal = openfile->current_y;
|
||||||
|
else if (manner == CENTERING)
|
||||||
if (goal > editwinrows - 1)
|
goal = editwinrows / 2;
|
||||||
statusline(ALERT, "Row is out of range -- please report a bug");
|
else if (!current_is_above_screen())
|
||||||
}
|
goal = editwinrows - 1;
|
||||||
|
|
||||||
openfile->edittop = openfile->current;
|
openfile->edittop = openfile->current;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
if (ISSET(SOFTWRAP))
|
if (ISSET(SOFTWRAP))
|
||||||
openfile->firstcolumn = (xplustabs() / editwincols) * editwincols;
|
openfile->firstcolumn = (xplustabs() / editwincols) * editwincols;
|
||||||
|
Loading…
Reference in New Issue
Block a user