commit 2a7c9b7f62b3fb303501c803b28789bf0e7e5185
parent 11463817650f96b49b9e2b32ffe534b7cd753873
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 17 Jul 2017 21:14:14 +0200
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/files.c b/src/files.c
@@ -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