files: don't bother counting rows when opening a fresh buffer

Counting the added number of rows is only relevant when inserting
a file into the current buffer.  So don't waste time counting when
it's not needed.

This fixes https://savannah.gnu.org/bugs/?51479.
master
Benno Schulenberg 2017-07-17 21:14:14 +02:00
parent 1146381765
commit 2a7c9b7f62
1 changed files with 1 additions and 1 deletions

View File

@ -926,7 +926,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
(unsigned long)num_lines), (unsigned long)num_lines);
/* If we inserted less than a screenful, don't center the cursor. */
if (less_than_a_screenful(was_lineno, was_leftedge))
if (undoable && less_than_a_screenful(was_lineno, was_leftedge))
focusing = FALSE;
#ifndef NANO_TINY