diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-27 12:11:12 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-07-27 12:11:12 +0000 |
commit | 8d43ed05648ba21ef2ba2b423111696b0dc5a287 (patch) | |
tree | add88ed7e7d7add3c36eb434b0a512186d9f0b58 /usr.bin/tmux | |
parent | 248e7c96313a12990bebc14ef4e1ae12a2cd46ec (diff) |
Add a key to delete to end of line at the prompt (^K in emacs mode, C/D in vi).
From Kalle Olavi Niemitalo.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/mode-key.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/status.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 5 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
4 files changed, 21 insertions, 5 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c index 850a1b69955..6329393edae 100644 --- a/usr.bin/tmux/mode-key.c +++ b/usr.bin/tmux/mode-key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-key.c,v 1.5 2009/07/26 21:42:08 nicm Exp $ */ +/* $OpenBSD: mode-key.c,v 1.6 2009/07/27 12:11:11 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -110,6 +110,12 @@ mode_key_lookup_vi(struct mode_key_data *mdata, int key) return (MODEKEYCMD_BACKTOINDENTATION); case '\033': return (MODEKEYCMD_CLEARSELECTION); + case 'C': + if (mdata->flags & MODEKEY_CANEDIT) + mdata->flags |= MODEKEY_EDITMODE; + return (MODEKEYCMD_DELETETOENDOFLINE); + case 'D': + return (MODEKEYCMD_DELETETOENDOFLINE); case 'j': case KEYC_DOWN: return (MODEKEYCMD_DOWN); @@ -169,6 +175,8 @@ mode_key_lookup_emacs(struct mode_key_data *mdata, int key) case '\027': case 'w' | KEYC_ESCAPE: return (MODEKEYCMD_COPYSELECTION); + case '\013': + return (MODEKEYCMD_DELETETOENDOFLINE); case '\016': case KEYC_DOWN: return (MODEKEYCMD_DOWN); diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c index 9be22294cc2..35e902fbc5b 100644 --- a/usr.bin/tmux/status.c +++ b/usr.bin/tmux/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.17 2009/07/26 21:13:47 nicm Exp $ */ +/* $OpenBSD: status.c,v 1.18 2009/07/27 12:11:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -823,6 +823,12 @@ status_prompt_key(struct client *c, int key) c->flags |= CLIENT_STATUS; } break; + case MODEKEYCMD_DELETETOENDOFLINE: + if (c->prompt_index < size) { + c->prompt_buffer[c->prompt_index] = '\0'; + c->flags |= CLIENT_STATUS; + } + break; case MODEKEYCMD_UP: if (server_locked) break; diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 56be4aadc3c..e356d14ec41 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.45 2009/07/24 14:52:47 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.46 2009/07/27 12:11:11 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 24 2009 $ +.Dd $Mdocdate: July 27 2009 $ .Dt TMUX 1 .Os .Sh NAME @@ -331,6 +331,7 @@ The following keys are supported as appropriate for the mode: .It Li "Cursor right" Ta "l" Ta "Right" .It Li "Start selection" Ta "Space" Ta "C-Space" .It Li "Cursor up" Ta "k" Ta "Up" +.It Li "Delete to end of line" Ta "D or C" Ta "C-k" .It Li "Paste buffer" Ta "p" Ta "C-y" .El .Pp diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 80730cfad03..d5934ac8afe 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.56 2009/07/26 21:42:08 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.57 2009/07/27 12:11:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -365,6 +365,7 @@ enum mode_key_cmd { MODEKEYCMD_COMPLETE, MODEKEYCMD_COPYSELECTION, MODEKEYCMD_DELETE, + MODEKEYCMD_DELETETOENDOFLINE, MODEKEYCMD_DOWN, MODEKEYCMD_ENDOFLINE, MODEKEYCMD_LEFT, |