mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Sync OpenBSD patchset 307:
Add a transpose-chars command in edit mode (C-t in emacs mode only). From Kalle Olavi Niemitalo.
This commit is contained in:
parent
afd0bd7cb0
commit
3b944fe7e8
@ -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 <nicm@users.sourceforge.net>
|
||||
@ -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 },
|
||||
|
16
status.c
16
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 <nicm@users.sourceforge.net>
|
||||
@ -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);
|
||||
|
5
tmux.1
5
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 <nicm@users.sourceforge.net>
|
||||
.\"
|
||||
@ -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:
|
||||
|
3
tmux.h
3
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 <nicm@users.sourceforge.net>
|
||||
@ -377,6 +377,7 @@ enum mode_key_cmd {
|
||||
MODEKEYEDIT_STARTOFLINE,
|
||||
MODEKEYEDIT_SWITCHMODE,
|
||||
MODEKEYEDIT_SWITCHMODEAPPEND,
|
||||
MODEKEYEDIT_TRANSPOSECHARS,
|
||||
|
||||
/* Menu (choice) keys. */
|
||||
MODEKEYCHOICE_CANCEL,
|
||||
|
Loading…
Reference in New Issue
Block a user