From d655f0832a469a8492b8c657c76dfd5d94990278 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 21 Apr 2017 22:23:24 +0000 Subject: [PATCH] Log error properly when no current state, and some other minor tweaks. --- usr.bin/tmux/cmd-find.c | 7 +++---- usr.bin/tmux/cmd-queue.c | 8 ++++---- usr.bin/tmux/server-client.c | 5 +---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/usr.bin/tmux/cmd-find.c b/usr.bin/tmux/cmd-find.c index b1603bddec2..a10464c2cef 100644 --- a/usr.bin/tmux/cmd-find.c +++ b/usr.bin/tmux/cmd-find.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-find.c,v 1.49 2017/04/21 22:00:06 nicm Exp $ */ +/* $OpenBSD: cmd-find.c,v 1.50 2017/04/21 22:23:24 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -974,9 +974,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmdq_item *item, fs->current = ¤t; log_debug("%s: current is from client", __func__); } else - return (-1); - if (!cmd_find_empty_state(fs->current) && - !cmd_find_valid_state(fs->current)) + goto error; + if (!cmd_find_valid_state(fs->current)) fatalx("invalid current find state"); /* An empty or NULL target is the current. */ diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c index eb039be743c..639dbe688bc 100644 --- a/usr.bin/tmux/cmd-queue.c +++ b/usr.bin/tmux/cmd-queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-queue.c,v 1.52 2017/04/21 20:34:05 nicm Exp $ */ +/* $OpenBSD: cmd-queue.c,v 1.53 2017/04/21 22:23:24 nicm Exp $ */ /* * Copyright (c) 2013 Nicholas Marriott @@ -203,14 +203,14 @@ cmdq_fire_command(struct cmdq_item *item) flags = !!(cmd->flags & CMD_CONTROL); cmdq_guard(item, "begin", flags); + if (item->client == NULL) + item->client = cmd_find_client(item, NULL, 1); + if (cmd_prepare_state(cmd, item) != 0) { retval = CMD_RETURN_ERROR; goto out; } - if (item->client == NULL) - item->client = cmd_find_client(item, NULL, 1); - retval = cmd->entry->exec(cmd, item); if (retval == CMD_RETURN_ERROR) goto out; diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index d14900a166d..12fb0c8cf56 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.225 2017/04/21 19:33:07 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.226 2017/04/21 22:23:24 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -950,9 +950,6 @@ retry: if (KEYC_IS_MOUSE(key) && m->valid && wp != NULL) { cmd_find_from_winlink_pane(&fs, s->curw, wp); cmd_find_log_state(__func__, &fs); - - if (!cmd_find_valid_state(&fs)) - fatalx("invalid key state"); key_bindings_dispatch(bd, c, m, &fs); } else key_bindings_dispatch(bd, c, m, NULL); -- 2.20.1