From 61b7dc522d175c5f2a8b38d177adcf7282820380 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 2 Sep 2009 06:33:20 +0000 Subject: Add a transpose-chars command in edit mode (C-t in emacs mode only). From Kalle Olavi Niemitalo. --- status.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'status.c') diff --git a/status.c b/status.c index e1fede15..f0e7ce62 100644 --- a/status.c +++ b/status.c @@ -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); -- cgit