scrolling: catch the special case of reading a file from standard input

Since commit dac0aa1, nano would leave edittop at current after reading
data from standard input, meaning that everything that had been read in
was invisible, "scrolled off" the top of the screen.  Correct this by
explicitly setting edittop.

The above does not happen for ^R (^X) because it has a special mechanism
to save and restore edittop.  Nor does it happen for ^R ^X M-F because it
sets current to the top of the file and refreshing the screen will make
edittop follow, or -- in case just one unterminated line was read in --
edittop will already be equal to current.
master
Benno Schulenberg 2016-04-25 15:44:52 +02:00
parent 981b414980
commit 907ba3a2e2
1 changed files with 2 additions and 0 deletions

View File

@ -1167,6 +1167,8 @@ void finish_stdin_pager(void)
nperror("fopen"); nperror("fopen");
read_file(f, 0, "stdin", TRUE, FALSE); read_file(f, 0, "stdin", TRUE, FALSE);
openfile->edittop = openfile->fileage;
ttystdin = open("/dev/tty", O_RDONLY); ttystdin = open("/dev/tty", O_RDONLY);
if (!ttystdin) if (!ttystdin)
die(_("Couldn't reopen stdin from keyboard, sorry\n")); die(_("Couldn't reopen stdin from keyboard, sorry\n"));