diff --git a/mode-key.c b/mode-key.c index 5e424cf7..9b277515 100644 --- a/mode-key.c +++ b/mode-key.c @@ -1,4 +1,4 @@ -/* $Id: mode-key.c,v 1.26 2009-08-20 11:20:24 tcunha Exp $ */ +/* $Id: mode-key.c,v 1.27 2009-08-20 11:22:47 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -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/status.c b/status.c index a8a7f34b..17122f52 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.110 2009-08-16 19:29:24 tcunha Exp $ */ +/* $Id: status.c,v 1.111 2009-08-20 11:22:47 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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/tmux.1 b/tmux.1 index e7c4355d..5d091b66 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $Id: tmux.1,v 1.152 2009-08-20 11:20:24 tcunha Exp $ +.\" $Id: tmux.1,v 1.153 2009-08-20 11:22:47 tcunha Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -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/tmux.h b/tmux.h index 4b941567..7a672d88 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.421 2009-08-20 11:20:24 tcunha Exp $ */ +/* $Id: tmux.h,v 1.422 2009-08-20 11:22:48 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -367,6 +367,7 @@ enum mode_key_cmd { MODEKEYEDIT_CURSORLEFT, MODEKEYEDIT_CURSORRIGHT, MODEKEYEDIT_DELETE, + MODEKEYEDIT_DELETELINE, MODEKEYEDIT_DELETETOENDOFLINE, MODEKEYEDIT_ENDOFLINE, MODEKEYEDIT_ENTER, diff --git a/window-copy.c b/window-copy.c index 88ba3244..6b58d874 100644 --- a/window-copy.c +++ b/window-copy.c @@ -1,4 +1,4 @@ -/* $Id: window-copy.c,v 1.80 2009-08-20 11:20:24 tcunha Exp $ */ +/* $Id: window-copy.c,v 1.81 2009-08-20 11:22:48 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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: