summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-05-23 18:39:01 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-05-23 18:39:01 +0000
commitaa2c02969081b192d47bfc7466cce32d21ed41e2 (patch)
treed2222f8a9aaa105fdc1d203e704294542b2a98ad /usr.bin/tmux
parenta6b50d53034cadf73cdd7f3734a481006486f386 (diff)
Fix line numbers - commands are added after the line ends so they need to
get line - 1.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cfg.c3
-rw-r--r--usr.bin/tmux/cmd-parse.y6
2 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c
index fedddc5f386..d58d89bbc7a 100644
--- a/usr.bin/tmux/cfg.c
+++ b/usr.bin/tmux/cfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfg.c,v 1.71 2019/05/23 11:13:30 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.72 2019/05/23 18:39:00 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -126,6 +126,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
memset(&pi, 0, sizeof pi);
pi.flags = flags;
pi.file = path;
+ pi.line = 1;
pr = cmd_parse_from_file(f, &pi);
fclose(f);
diff --git a/usr.bin/tmux/cmd-parse.y b/usr.bin/tmux/cmd-parse.y
index 65498ba3c5c..d57dc57be16 100644
--- a/usr.bin/tmux/cmd-parse.y
+++ b/usr.bin/tmux/cmd-parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-parse.y,v 1.2 2019/05/23 14:03:44 nicm Exp $ */
+/* $OpenBSD: cmd-parse.y,v 1.3 2019/05/23 18:39:00 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -356,7 +356,7 @@ command : assignment TOKEN
$$ = xcalloc(1, sizeof *$$);
$$->name = $2;
- $$->line = ps->input->line;
+ $$->line = ps->input->line - 1;
}
| assignment TOKEN arguments
@@ -365,7 +365,7 @@ command : assignment TOKEN
$$ = xcalloc(1, sizeof *$$);
$$->name = $2;
- $$->line = ps->input->line;
+ $$->line = ps->input->line - 1;
$$->argc = $3.argc;
$$->argv = $3.argv;