summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-18 07:23:44 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-18 07:23:44 +0000
commitbad94970bfb381c9d51d8f5188d6b2f59acac07b (patch)
treed1a2b9511983abe5fbd939a4ea19a44940eab3c2 /usr.bin/tmux
parent1cee65b0f7d3e704516348940da523cc3b61ff43 (diff)
Add a "delete line" key when editing in the status line or the search up/down
prompt. C-u with emacs keys, d with vi.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/mode-key.c7
-rw-r--r--usr.bin/tmux/status.c7
-rw-r--r--usr.bin/tmux/tmux.13
-rw-r--r--usr.bin/tmux/tmux.h3
-rw-r--r--usr.bin/tmux/window-copy.c5
5 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/tmux/mode-key.c b/usr.bin/tmux/mode-key.c
index ac0cdaa8214..866d0744665 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.15 2009/08/18 07:08:26 nicm Exp $ */
+/* $OpenBSD: mode-key.c,v 1.16 2009/08/18 07:23:43 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -47,6 +47,7 @@ struct mode_key_cmdstr mode_key_cmdstr_edit[] = {
{ MODEKEYEDIT_CURSORLEFT, "cursor-left" },
{ MODEKEYEDIT_CURSORRIGHT, "cursor-right" },
{ MODEKEYEDIT_DELETE, "delete" },
+ { MODEKEYEDIT_DELETELINE, "delete-line" },
{ MODEKEYEDIT_DELETETOENDOFLINE, "delete-end-of-line" },
{ MODEKEYEDIT_ENDOFLINE, "end-of-line" },
{ MODEKEYEDIT_ENTER, "enter" },
@@ -109,6 +110,7 @@ const struct mode_key_entry mode_key_vi_edit[] = {
{ '$', 1, MODEKEYEDIT_ENDOFLINE },
{ '0', 1, MODEKEYEDIT_STARTOFLINE },
+ { 'd', 1, MODEKEYEDIT_DELETELINE },
{ 'D', 1, MODEKEYEDIT_DELETETOENDOFLINE },
{ '\003' /* C-c */, 1, MODEKEYEDIT_CANCEL },
{ '\010' /* C-h */, 1, MODEKEYEDIT_BACKSPACE },
@@ -194,10 +196,11 @@ const struct mode_key_entry mode_key_emacs_edit[] = {
{ '\005' /* C-e */, 0, MODEKEYEDIT_ENDOFLINE },
{ '\006' /* C-f */, 0, MODEKEYEDIT_CURSORRIGHT },
{ '\010' /* C-H */, 0, MODEKEYEDIT_BACKSPACE },
- { '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE },
+ { '\011' /* Tab */, 0, MODEKEYEDIT_COMPLETE },
{ '\013' /* C-k */, 0, MODEKEYEDIT_DELETETOENDOFLINE },
{ '\016' /* C-n */, 0, MODEKEYEDIT_HISTORYDOWN },
{ '\020' /* C-p */, 0, MODEKEYEDIT_HISTORYUP },
+ { '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE },
{ '\031' /* C-y */, 0, MODEKEYEDIT_PASTE },
{ '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL },
{ '\r', 0, MODEKEYEDIT_ENTER },
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index 3a6b9f62186..9ba6f528ec0 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.25 2009/08/13 23:44:18 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.26 2009/08/18 07:23:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -854,6 +854,11 @@ status_prompt_key(struct client *c, int key)
c->flags |= CLIENT_STATUS;
}
break;
+ case MODEKEYEDIT_DELETELINE:
+ *c->prompt_buffer = '\0';
+ c->prompt_index = 0;
+ c->flags |= CLIENT_STATUS;
+ break;
case MODEKEYEDIT_DELETETOENDOFLINE:
if (c->prompt_index < size) {
c->prompt_buffer[c->prompt_index] = '\0';
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 7c1b395a828..3eac3f547d6 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.70 2009/08/18 07:08:26 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.71 2009/08/18 07:23:43 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -482,6 +482,7 @@ The following keys are supported as appropriate for the mode:
.It Li "Cursor left" Ta "h" Ta "Left"
.It Li "Cursor right" Ta "l" Ta "Right"
.It Li "Cursor up" Ta "k" Ta "Up"
+.It Li "Delete entire line" Ta "d" Ta "C-u"
.It Li "Delete to end of line" Ta "D" Ta "C-k"
.It Li "End of line" Ta "$" Ta "C-e"
.It Li "Goto line" Ta "g" Ta "g"
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index c1bc9df1923..1dbb464bc90 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.83 2009/08/18 07:08:26 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.84 2009/08/18 07:23:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -369,6 +369,7 @@ enum mode_key_cmd {
MODEKEYEDIT_CURSORLEFT,
MODEKEYEDIT_CURSORRIGHT,
MODEKEYEDIT_DELETE,
+ MODEKEYEDIT_DELETELINE,
MODEKEYEDIT_DELETETOENDOFLINE,
MODEKEYEDIT_ENDOFLINE,
MODEKEYEDIT_ENTER,
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 9e1fc1629fb..20c0ab7d8a3 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.21 2009/08/18 07:08:26 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.22 2009/08/18 07:23:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -365,6 +365,9 @@ window_copy_key_input(struct window_pane *wp, int key)
if (inputlen > 0)
data->inputstr[inputlen - 1] = '\0';
break;
+ case MODEKEYEDIT_DELETELINE:
+ *data->inputstr = '\0';
+ break;
case MODEKEYEDIT_ENTER:
switch (data->inputtype) {
case WINDOW_COPY_OFF: