From 9555ddc7d0c639983cb61434f0235f2f0e421372 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Fri, 17 Mar 2017 09:39:13 -0500 Subject: [PATCH 1/2] tweaks: fix line number range check when seeing if we should center It's not enough to check if it's non-zero, as it could be non-zero due to being negative or positive and out of range. Make sure it's over zero and within (editwincols / 2). --- src/search.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search.c b/src/search.c index fbad3eb..474bd60 100644 --- a/src/search.c +++ b/src/search.c @@ -911,7 +911,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, rows_from_tail = openfile->filebot->lineno - openfile->current->lineno; - if (rows_from_tail != 0) { + if (rows_from_tail > 0 && rows_from_tail < editwinrows / 2) { openfile->current_y = editwinrows - 1 - rows_from_tail; adjust_viewport(STATIONARY); } else -- 2.9.0