From b5ed4cf757afc50afb6ac499eee7b87a2648fa4c Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Thu, 6 Apr 2023 21:47:09 +0200 Subject: fix what I messed up Undo was relying on buffer_goto being 0-indexed when it comes to lines, whereas the new --line flag was not. --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 40de819..c0b6b0c 100644 --- a/src/main.c +++ b/src/main.c @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { {NULL, 0, NULL, 0}}; char *filename = NULL; - uint32_t jumpline = 0; + uint32_t jumpline = 1; bool goto_end = false; char ch; while ((ch = getopt_long(argc, argv, "el:", longopts, NULL)) != -1) { @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) { if (goto_end) { buffer_goto_end(&initial_buffer); } else - buffer_goto(&initial_buffer, jumpline, 0); + buffer_goto(&initial_buffer, jumpline > 0 ? jumpline - 1 : 0, 0); } else { const char *welcome_txt = "Welcome to the editor for datagubbar 👴\n"; buffer_add_text(&initial_buffer, (uint8_t *)welcome_txt, -- cgit v1.2.3