From 46cb0de3471aed81ba5a495b46f9c218f2238e8e Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Tue, 28 Jul 2009 22:44:38 +0000 Subject: [PATCH] Sync OpenBSD patchset 187: Add a key to delete to end of line at the prompt (^K in emacs mode, C/D in vi). From Kalle Olavi Niemitalo. --- mode-key.c | 10 +++++++++- status.c | 8 +++++++- tmux.1 | 3 ++- tmux.h | 3 ++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/mode-key.c b/mode-key.c index 2a895b5e..ecb675df 100644 --- a/mode-key.c +++ b/mode-key.c @@ -1,4 +1,4 @@ -/* $Id: mode-key.c,v 1.16 2009-07-28 22:37:02 tcunha Exp $ */ +/* $Id: mode-key.c,v 1.17 2009-07-28 22:44:38 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -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/status.c b/status.c index 7bb550ad..87234ff2 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.102 2009-07-28 22:32:15 tcunha Exp $ */ +/* $Id: status.c,v 1.103 2009-07-28 22:44:38 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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/tmux.1 b/tmux.1 index e8d3d7ec..c44f6e7e 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $Id: tmux.1,v 1.131 2009-07-25 08:52:04 tcunha Exp $ +.\" $Id: tmux.1,v 1.132 2009-07-28 22:44:38 tcunha Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -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/tmux.h b/tmux.h index 0dcd8bb5..a972b40a 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.391 2009-07-28 22:37:02 tcunha Exp $ */ +/* $Id: tmux.h,v 1.392 2009-07-28 22:44:38 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -364,6 +364,7 @@ enum mode_key_cmd { MODEKEYCMD_COMPLETE, MODEKEYCMD_COPYSELECTION, MODEKEYCMD_DELETE, + MODEKEYCMD_DELETETOENDOFLINE, MODEKEYCMD_DOWN, MODEKEYCMD_ENDOFLINE, MODEKEYCMD_LEFT,