diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-08-20 11:20:24 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-08-20 11:20:24 +0000 |
commit | 70fc0858628a430fb8c2a9415d63d192939cc5b7 (patch) | |
tree | 6a473d8507bd48c9fb630be655d0890175ca1b23 /mode-key.c | |
parent | 09cc5302994a5f245dbbe5875e5e0670f9332a19 (diff) | |
download | rtmux-70fc0858628a430fb8c2a9415d63d192939cc5b7.tar.gz rtmux-70fc0858628a430fb8c2a9415d63d192939cc5b7.tar.bz2 rtmux-70fc0858628a430fb8c2a9415d63d192939cc5b7.zip |
Sync OpenBSD patchset 264:
Add (naive) searching and goto line in copy mode. Searching is C-r and C-s with
emacs keys, / and ? with vi; n repeats the search again with either key
set. All searching wraps the top/bottom. Goto line is g for both emacs and vi.
The search prompts don't have full line editing, just simple append and delete
characters.
Also sort the mode keys list in tmux.1.
Diffstat (limited to 'mode-key.c')
-rw-r--r-- | mode-key.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: mode-key.c,v 1.25 2009-08-16 19:29:24 tcunha Exp $ */ +/* $Id: mode-key.c,v 1.26 2009-08-20 11:20:24 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -74,18 +74,22 @@ struct mode_key_cmdstr mode_key_cmdstr_choice[] = { /* Copy keys command strings. */ struct mode_key_cmdstr mode_key_cmdstr_copy[] = { - { MODEKEYCOPY_CANCEL, "cancel" }, { MODEKEYCOPY_BACKTOINDENTATION, "back-to-indentation" }, + { MODEKEYCOPY_CANCEL, "cancel" }, { MODEKEYCOPY_CLEARSELECTION, "clear-selection" }, { MODEKEYCOPY_COPYSELECTION, "copy-selection" }, { MODEKEYCOPY_DOWN, "cursor-down" }, { MODEKEYCOPY_ENDOFLINE, "end-of-line" }, + { MODEKEYCOPY_GOTOLINE, "goto-line" }, { MODEKEYCOPY_LEFT, "cursor-left" }, { MODEKEYCOPY_NEXTPAGE, "page-down" }, { MODEKEYCOPY_NEXTWORD, "next-word" }, { MODEKEYCOPY_PREVIOUSPAGE, "page-up" }, { MODEKEYCOPY_PREVIOUSWORD, "previous-word" }, { MODEKEYCOPY_RIGHT, "cursor-right" }, + { MODEKEYCOPY_SEARCHAGAIN, "search-again" }, + { MODEKEYCOPY_SEARCHDOWN, "search-forward" }, + { MODEKEYCOPY_SEARCHUP, "search-backward" }, { MODEKEYCOPY_STARTOFLINE, "start-of-line" }, { MODEKEYCOPY_STARTSELECTION, "begin-selection" }, { MODEKEYCOPY_UP, "cursor-up" }, @@ -148,7 +152,9 @@ struct mode_key_tree mode_key_tree_vi_choice; const struct mode_key_entry mode_key_vi_copy[] = { { ' ', 0, MODEKEYCOPY_STARTSELECTION }, { '$', 0, MODEKEYCOPY_ENDOFLINE }, + { '/', 0, MODEKEYCOPY_SEARCHUP }, { '0', 0, MODEKEYCOPY_STARTOFLINE }, + { '?', 0, MODEKEYCOPY_SEARCHDOWN }, { '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE }, { '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL }, { '\004' /* C-d */, 0, MODEKEYCOPY_HALFPAGEDOWN }, @@ -159,10 +165,12 @@ const struct mode_key_entry mode_key_vi_copy[] = { { '\r', 0, MODEKEYCOPY_COPYSELECTION }, { '^', 0, MODEKEYCOPY_BACKTOINDENTATION }, { 'b', 0, MODEKEYCOPY_PREVIOUSWORD }, + { 'g', 0, MODEKEYCOPY_GOTOLINE }, { 'h', 0, MODEKEYCOPY_LEFT }, { 'j', 0, MODEKEYCOPY_DOWN }, { 'k', 0, MODEKEYCOPY_UP }, { 'l', 0, MODEKEYCOPY_RIGHT }, + { 'n', 0, MODEKEYCOPY_SEARCHAGAIN }, { 'q', 0, MODEKEYCOPY_CANCEL }, { 'w', 0, MODEKEYCOPY_NEXTWORD }, { KEYC_BSPACE, 0, MODEKEYCOPY_LEFT }, @@ -232,12 +240,16 @@ const struct mode_key_entry mode_key_emacs_copy[] = { { '\007' /* C-g */, 0, MODEKEYCOPY_CLEARSELECTION }, { '\016' /* C-n */, 0, MODEKEYCOPY_DOWN }, { '\020' /* C-p */, 0, MODEKEYCOPY_UP }, + { '\022' /* C-r */, 0, MODEKEYCOPY_SEARCHUP }, + { '\023' /* C-s */, 0, MODEKEYCOPY_SEARCHDOWN }, { '\026' /* C-v */, 0, MODEKEYCOPY_NEXTPAGE }, { '\027' /* C-w */, 0, MODEKEYCOPY_COPYSELECTION }, { '\033' /* Escape */, 0, MODEKEYCOPY_CANCEL }, { 'b' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSWORD }, { 'f' | KEYC_ESCAPE, 0, MODEKEYCOPY_NEXTWORD }, + { 'g', 0, MODEKEYCOPY_GOTOLINE }, { 'm' | KEYC_ESCAPE, 0, MODEKEYCOPY_BACKTOINDENTATION }, + { 'n', 0, MODEKEYCOPY_SEARCHAGAIN }, { 'q', 0, MODEKEYCOPY_CANCEL }, { 'v' | KEYC_ESCAPE, 0, MODEKEYCOPY_PREVIOUSPAGE }, { 'w' | KEYC_ESCAPE, 0, MODEKEYCOPY_COPYSELECTION }, |