diff --git a/mode-key.c b/mode-key.c index 9b277515..5438d0e6 100644 --- a/mode-key.c +++ b/mode-key.c @@ -1,4 +1,4 @@ -/* $Id: mode-key.c,v 1.27 2009-08-20 11:22:47 tcunha Exp $ */ +/* $Id: mode-key.c,v 1.28 2009-09-02 22:45:17 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -57,6 +57,7 @@ struct mode_key_cmdstr mode_key_cmdstr_edit[] = { { MODEKEYEDIT_STARTOFLINE, "start-of-line" }, { MODEKEYEDIT_SWITCHMODE, "switch-mode" }, { MODEKEYEDIT_SWITCHMODEAPPEND, "switch-mode-append" }, + { MODEKEYEDIT_TRANSPOSECHARS, "transpose-chars" }, { 0, NULL } }; @@ -200,6 +201,7 @@ const struct mode_key_entry mode_key_emacs_edit[] = { { '\013' /* C-k */, 0, MODEKEYEDIT_DELETETOENDOFLINE }, { '\016' /* C-n */, 0, MODEKEYEDIT_HISTORYDOWN }, { '\020' /* C-p */, 0, MODEKEYEDIT_HISTORYUP }, + { '\024' /* C-t */, 0, MODEKEYEDIT_TRANSPOSECHARS }, { '\025' /* C-u */, 0, MODEKEYEDIT_DELETELINE }, { '\031' /* C-y */, 0, MODEKEYEDIT_PASTE }, { '\033' /* Escape */, 0, MODEKEYEDIT_CANCEL }, diff --git a/status.c b/status.c index 406d3eca..3057d138 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.114 2009-09-02 00:55:49 tcunha Exp $ */ +/* $Id: status.c,v 1.115 2009-09-02 22:45:17 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -763,7 +763,7 @@ void status_prompt_key(struct client *c, int key) { struct paste_buffer *pb; - char *s, *first, *last, word[64]; + char *s, *first, *last, word[64], swapc; size_t size, n, off, idx; size = strlen(c->prompt_buffer); @@ -933,6 +933,18 @@ status_prompt_key(struct client *c, int key) c->flags |= CLIENT_STATUS; break; + case MODEKEYEDIT_TRANSPOSECHARS: + idx = c->prompt_index; + if (idx < size) + idx++; + if (idx >= 2) { + swapc = c->prompt_buffer[idx - 2]; + c->prompt_buffer[idx - 2] = c->prompt_buffer[idx - 1]; + c->prompt_buffer[idx - 1] = swapc; + c->prompt_index = idx; + c->flags |= CLIENT_STATUS; + } + break; case MODEKEYEDIT_ENTER: if (*c->prompt_buffer != '\0') status_prompt_add_history(c); diff --git a/tmux.1 b/tmux.1 index 1ab01e34..4620acb1 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $Id: tmux.1,v 1.161 2009-09-02 01:02:44 tcunha Exp $ +.\" $Id: tmux.1,v 1.162 2009-09-02 22:45:17 tcunha Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -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: September 1 2009 $ +.Dd $Mdocdate: September 2 2009 $ .Dt TMUX 1 .Os .Sh NAME @@ -497,6 +497,7 @@ The following keys are supported as appropriate for the mode: .It Li "Search forward" Ta "/" Ta "C-s" .It Li "Start of line" Ta "0" Ta "C-a" .It Li "Start selection" Ta "Space" Ta "C-Space" +.It Li "Transpose chars" Ta "" Ta "C-t" .El .Pp These key bindings are defined in a set of named tables: diff --git a/tmux.h b/tmux.h index 0438adb3..05fe641f 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.433 2009-09-02 20:16:29 nicm Exp $ */ +/* $Id: tmux.h,v 1.434 2009-09-02 22:45:17 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -377,6 +377,7 @@ enum mode_key_cmd { MODEKEYEDIT_STARTOFLINE, MODEKEYEDIT_SWITCHMODE, MODEKEYEDIT_SWITCHMODEAPPEND, + MODEKEYEDIT_TRANSPOSECHARS, /* Menu (choice) keys. */ MODEKEYCHOICE_CANCEL,