mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 10:08:47 +00:00
Only send end guard if begin was sent, from George Nachman.
This commit is contained in:
parent
4d38b6d1fa
commit
c5ad47ee7c
21
cmd-queue.c
21
cmd-queue.c
@ -152,19 +152,20 @@ cmdq_error(struct cmd_q *cmdq, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Print a guard line. */
|
/* Print a guard line. */
|
||||||
void
|
int
|
||||||
cmdq_guard(struct cmd_q *cmdq, const char *guard)
|
cmdq_guard(struct cmd_q *cmdq, const char *guard)
|
||||||
{
|
{
|
||||||
struct client *c = cmdq->client;
|
struct client *c = cmdq->client;
|
||||||
|
|
||||||
if (c == NULL || c->session == NULL)
|
if (c == NULL || c->session == NULL)
|
||||||
return;
|
return 0;
|
||||||
if (!(c->flags & CLIENT_CONTROL))
|
if (!(c->flags & CLIENT_CONTROL))
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u\n", guard,
|
evbuffer_add_printf(c->stdout_data, "%%%s %ld %u\n", guard,
|
||||||
(long) cmdq->time, cmdq->number);
|
(long) cmdq->time, cmdq->number);
|
||||||
server_push_stdout(c);
|
server_push_stdout(c);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add command list to queue and begin processing if needed. */
|
/* Add command list to queue and begin processing if needed. */
|
||||||
@ -197,7 +198,7 @@ cmdq_continue(struct cmd_q *cmdq)
|
|||||||
{
|
{
|
||||||
struct cmd_q_item *next;
|
struct cmd_q_item *next;
|
||||||
enum cmd_retval retval;
|
enum cmd_retval retval;
|
||||||
int empty;
|
int empty, guard;
|
||||||
char s[1024];
|
char s[1024];
|
||||||
|
|
||||||
notify_disable();
|
notify_disable();
|
||||||
@ -223,12 +224,14 @@ cmdq_continue(struct cmd_q *cmdq)
|
|||||||
cmdq->time = time(NULL);
|
cmdq->time = time(NULL);
|
||||||
cmdq->number++;
|
cmdq->number++;
|
||||||
|
|
||||||
cmdq_guard(cmdq, "begin");
|
guard = cmdq_guard(cmdq, "begin");
|
||||||
retval = cmdq->cmd->entry->exec(cmdq->cmd, cmdq);
|
retval = cmdq->cmd->entry->exec(cmdq->cmd, cmdq);
|
||||||
if (retval == CMD_RETURN_ERROR)
|
if (guard) {
|
||||||
cmdq_guard(cmdq, "error");
|
if (retval == CMD_RETURN_ERROR)
|
||||||
else
|
cmdq_guard(cmdq, "error");
|
||||||
cmdq_guard(cmdq, "end");
|
else
|
||||||
|
cmdq_guard(cmdq, "end");
|
||||||
|
}
|
||||||
|
|
||||||
if (retval == CMD_RETURN_ERROR)
|
if (retval == CMD_RETURN_ERROR)
|
||||||
break;
|
break;
|
||||||
|
2
tmux.h
2
tmux.h
@ -1856,7 +1856,7 @@ int cmdq_free(struct cmd_q *);
|
|||||||
void printflike2 cmdq_print(struct cmd_q *, const char *, ...);
|
void printflike2 cmdq_print(struct cmd_q *, const char *, ...);
|
||||||
void printflike2 cmdq_info(struct cmd_q *, const char *, ...);
|
void printflike2 cmdq_info(struct cmd_q *, const char *, ...);
|
||||||
void printflike2 cmdq_error(struct cmd_q *, const char *, ...);
|
void printflike2 cmdq_error(struct cmd_q *, const char *, ...);
|
||||||
void cmdq_guard(struct cmd_q *, const char *);
|
int cmdq_guard(struct cmd_q *, const char *);
|
||||||
void cmdq_run(struct cmd_q *, struct cmd_list *);
|
void cmdq_run(struct cmd_q *, struct cmd_list *);
|
||||||
void cmdq_append(struct cmd_q *, struct cmd_list *);
|
void cmdq_append(struct cmd_q *, struct cmd_list *);
|
||||||
int cmdq_continue(struct cmd_q *);
|
int cmdq_continue(struct cmd_q *);
|
||||||
|
Loading…
Reference in New Issue
Block a user