mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
If stdin in the client is enable immediately, tmux will eat anything
sent to stdin before it is needed, which can be inconvenient (eg pasting commands). Instead, start with stdin disabled and reuse MSG_STDIN from server->client to mean that stdin should be enabled. Based on a diff from Chris Johnsen.
This commit is contained in:
parent
d6066552ee
commit
f536dc47c4
7
client.c
7
client.c
@ -285,7 +285,6 @@ client_main(int argc, char **argv, int flags)
|
|||||||
|
|
||||||
/* Set the event and dispatch. */
|
/* Set the event and dispatch. */
|
||||||
client_update_event();
|
client_update_event();
|
||||||
event_add (&client_stdin, NULL);
|
|
||||||
event_dispatch();
|
event_dispatch();
|
||||||
|
|
||||||
/* Print the exit message, if any, and exit. */
|
/* Print the exit message, if any, and exit. */
|
||||||
@ -520,6 +519,12 @@ client_dispatch_wait(void *data)
|
|||||||
event_del(&client_stdin);
|
event_del(&client_stdin);
|
||||||
client_attached = 1;
|
client_attached = 1;
|
||||||
break;
|
break;
|
||||||
|
case MSG_STDIN:
|
||||||
|
if (datalen != 0)
|
||||||
|
fatalx("bad MSG_STDIN size");
|
||||||
|
|
||||||
|
event_add(&client_stdin, NULL);
|
||||||
|
break;
|
||||||
case MSG_STDOUT:
|
case MSG_STDOUT:
|
||||||
if (datalen != sizeof stdoutdata)
|
if (datalen != sizeof stdoutdata)
|
||||||
fatalx("bad MSG_STDOUT");
|
fatalx("bad MSG_STDOUT");
|
||||||
|
@ -581,5 +581,8 @@ server_set_stdin_callback(struct client *c, void (*cb)(struct client *, int,
|
|||||||
|
|
||||||
if (c->stdin_closed)
|
if (c->stdin_closed)
|
||||||
c->stdin_callback (c, 1, c->stdin_callback_data);
|
c->stdin_callback (c, 1, c->stdin_callback_data);
|
||||||
|
|
||||||
|
server_write_client(c, MSG_STDIN, NULL, 0);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user