summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-11-19 22:46:47 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-11-19 22:46:47 +0000
commit60a53bd3d75f62db2ac7869f8182ab1488a64473 (patch)
treeb4962313ba0f1cbe859a9d07a88b0507ee04add2 /usr.bin
parent996b2a39e8e8bf59bf1b0e8f8429b4bc1fca591e (diff)
Only assume pasting with at least two characters, reduces problems for
people who can type ^B c very fast, or who are using tmux inside something else that buffers.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/server-client.c14
-rw-r--r--usr.bin/tmux/tmux.h9
2 files changed, 16 insertions, 7 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 733c0804cc8..4f49b812c02 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.170 2015/11/18 14:27:44 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.171 2015/11/19 22:46:46 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -494,8 +494,16 @@ server_client_assume_paste(struct session *s)
return (0);
timersub(&s->activity_time, &s->last_activity_time, &tv);
- if (tv.tv_sec == 0 && tv.tv_usec < t * 1000)
- return (1);
+ if (tv.tv_sec == 0 && tv.tv_usec < t * 1000) {
+ log_debug("session %s pasting (flag %d)", s->name,
+ !!(s->flags & SESSION_PASTING));
+ if (s->flags & SESSION_PASTING)
+ return (1);
+ s->flags |= SESSION_PASTING;
+ return (0);
+ }
+ log_debug("session %s not pasting", s->name);
+ s->flags &= ~SESSION_PASTING;
return (0);
}
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index fdae389a737..65568f79ad2 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.582 2015/11/18 14:27:44 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.583 2015/11/19 22:46:46 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -33,6 +33,8 @@
#include <stdio.h>
#include <termios.h>
+#include "xmalloc.h"
+
extern char *__progname;
extern char **environ;
@@ -45,8 +47,6 @@ struct session;
struct tmuxpeer;
struct tmuxproc;
-#include "xmalloc.h"
-
/* Default global configuration file. */
#define TMUX_CONF "/etc/tmux.conf"
@@ -1014,6 +1014,7 @@ struct session {
struct options *options;
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */
+#define SESSION_PASTING 0x2
int flags;
u_int attached;
@@ -1147,7 +1148,7 @@ struct tty {
struct tty_key *key_tree;
};
-/* TTY command context and function pointer. */
+/* TTY command context. */
struct tty_ctx {
struct window_pane *wp;