From 2a7c9b7f62b3fb303501c803b28789bf0e7e5185 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 17 Jul 2017 21:14:14 +0200 Subject: [PATCH] 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. --- src/files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 1ebfe396..bac0e1bf 100644 --- 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