summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2023-04-06 21:47:09 +0200
committerAlbert Cervin <albert@acervin.com>2023-04-06 21:47:09 +0200
commitb5ed4cf757afc50afb6ac499eee7b87a2648fa4c (patch)
treef996336af26cdd74d0e1267f7b3127ab24c6372a /src/main.c
parenta8e6015bd5d46132f62a64e62f80a199260dc62d (diff)
downloaddged-b5ed4cf757afc50afb6ac499eee7b87a2648fa4c.tar.gz
dged-b5ed4cf757afc50afb6ac499eee7b87a2648fa4c.tar.xz
dged-b5ed4cf757afc50afb6ac499eee7b87a2648fa4c.zip
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.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c4
1 files changed, 2 insertions, 2 deletions
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,