diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-07-12 17:11:39 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-07-12 17:11:39 +0000 |
commit | 27fc963631b5e2ac1064823380e54cc48ad2aad8 (patch) | |
tree | c0227da222dcbbddff3ff1e69dfd0631f3c604c6 /cmd-generic.c | |
parent | d8de72ca77a6bbe2e8b9244480d700d343a6a656 (diff) | |
download | rtmux-27fc963631b5e2ac1064823380e54cc48ad2aad8.tar.gz rtmux-27fc963631b5e2ac1064823380e54cc48ad2aad8.tar.bz2 rtmux-27fc963631b5e2ac1064823380e54cc48ad2aad8.zip |
When pasting, translate \n into \r. This matches xterm and putty's behaviour,
and makes emacs happy when pasting into some modes. A new -r (raw) flag to
paste-buffer pastes without the translation.
From Kalle Olavi Niemitalo, thanks!
Diffstat (limited to 'cmd-generic.c')
-rw-r--r-- | cmd-generic.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd-generic.c b/cmd-generic.c index 342d592d..b82f9c8e 100644 --- a/cmd-generic.c +++ b/cmd-generic.c @@ -1,4 +1,4 @@ -/* $Id: cmd-generic.c,v 1.28 2009-05-21 19:47:57 nicm Exp $ */ +/* $Id: cmd-generic.c,v 1.29 2009-07-12 17:11:39 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -23,9 +23,9 @@ #include "tmux.h" -#define CMD_FLAGS "adDgkuU" +#define CMD_FLAGS "adDgkruU" #define CMD_FLAGMASK (CMD_AFLAG|CMD_DFLAG|CMD_BIGDFLAG|CMD_GFLAG|CMD_KFLAG| \ - CMD_UFLAG|CMD_BIGUFLAG) + CMD_RFLAG|CMD_UFLAG|CMD_BIGUFLAG) int cmd_do_flags(int, int, int *); size_t cmd_print_flags(char *, size_t, size_t, int); @@ -73,6 +73,12 @@ cmd_do_flags(int opt, int iflags, int *oflags) return (0); } return (-1); + case 'r': + if (iflags & CMD_RFLAG) { + (*oflags) |= CMD_RFLAG; + return (0); + } + return (-1); case 'u': if (iflags & CMD_UFLAG) { (*oflags) |= CMD_UFLAG; @@ -107,6 +113,8 @@ cmd_print_flags(char *buf, size_t len, size_t off, int flags) off += xsnprintf(buf + off, len - off, "g"); if (off < len && flags & CMD_KFLAG) off += xsnprintf(buf + off, len - off, "k"); + if (off < len && flags & CMD_RFLAG) + off += xsnprintf(buf + off, len - off, "r"); if (off < len && flags & CMD_UFLAG) off += xsnprintf(buf + off, len - off, "u"); if (off < len && flags & CMD_BIGUFLAG) |