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.
This commit is contained in:
nicm 2015-11-19 22:46:46 +00:00
parent 98967c5ec9
commit 374e273df5
2 changed files with 14 additions and 5 deletions

View File

@ -494,8 +494,16 @@ server_client_assume_paste(struct session *s)
return (0); return (0);
timersub(&s->activity_time, &s->last_activity_time, &tv); timersub(&s->activity_time, &s->last_activity_time, &tv);
if (tv.tv_sec == 0 && tv.tv_usec < t * 1000) if (tv.tv_sec == 0 && tv.tv_usec < t * 1000) {
return (1); 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); return (0);
} }

7
tmux.h
View File

@ -33,6 +33,8 @@
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>
#include "xmalloc.h"
extern char *__progname; extern char *__progname;
extern char **environ; extern char **environ;
@ -45,8 +47,6 @@ struct session;
struct tmuxpeer; struct tmuxpeer;
struct tmuxproc; struct tmuxproc;
#include "xmalloc.h"
/* Default global configuration file. */ /* Default global configuration file. */
#define TMUX_CONF "/etc/tmux.conf" #define TMUX_CONF "/etc/tmux.conf"
@ -1014,6 +1014,7 @@ struct session {
struct options *options; struct options *options;
#define SESSION_UNATTACHED 0x1 /* not attached to any clients */ #define SESSION_UNATTACHED 0x1 /* not attached to any clients */
#define SESSION_PASTING 0x2
int flags; int flags;
u_int attached; u_int attached;
@ -1147,7 +1148,7 @@ struct tty {
struct tty_key *key_tree; struct tty_key *key_tree;
}; };
/* TTY command context and function pointer. */ /* TTY command context. */
struct tty_ctx { struct tty_ctx {
struct window_pane *wp; struct window_pane *wp;