From 8b80ec3e1aa701f6259cfa9e9247937c4f7611ca Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 23 Jun 2017 10:25:12 +0200 Subject: [PATCH] startup: allow negative line and column numbers on the command line They can be given at the prompt, so it's better to accept them on the command line too. --- src/nano.c | 2 +- src/search.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/nano.c b/src/nano.c index fe038f5c..a39a866a 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2551,7 +2551,7 @@ int main(int argc, char **argv) continue; /* If a position was given on the command line, go there. */ - if (givenline > 0 || givencol > 0) + if (givenline != 0 || givencol != 0) do_gotolinecolumn(givenline, givencol, FALSE, FALSE); #ifndef DISABLE_HISTORIES else if (ISSET(POS_HISTORY)) { diff --git a/src/search.c b/src/search.c index 152045e0..8b7b2502 100644 --- a/src/search.c +++ b/src/search.c @@ -859,10 +859,10 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, return; } } else { - if (line < 1) + if (line == 0) line = openfile->current->lineno; - if (column < 1) + if (column == 0) column = openfile->placewewant + 1; }