git-gui blame add more common search hotkeys
PATCH 2/2 git-gui blame add more common search hotkeys
add slash and Control-S to bring up search
enter, n, Shift-Enter, Shift-n to to go the next and previous entries
search hotkey return is find_next shift prev
--- git-gui/lib/blame.tcl | 4 ++++ git-gui/lib/search.tcl | 4 +++- 2 files changed, 7 insertions(+), 1 deletions(-)
git-gui/lib/blame.tcl +4 -0
@@ -352,9 +352,13 @@ constructor new {i_commit i_path i_jump} { bind $w_cviewer <Button-1> [list focus $w_cviewer] bind $w_file <Visibility> [cb _focus_search $w_file] bind $top <F7> [list searchbar::show $finder] + bind $top <Key-slash> [list searchbar::show $finder] + bind $top <Control-Key-s> [list searchbar::show $finder] bind $top <Escape> [list searchbar::hide $finder] bind $top <F3> [list searchbar::find_next $finder] + bind $top <Key-n> [list searchbar::find_next $finder] bind $top <Shift-F3> [list searchbar::find_prev $finder] + bind $top <Shift-Key-n> [list searchbar::find_prev $finder] bind $top <Control-Key-g> [list linebar::show $gotoline] catch { bind $top <Shift-Key-XF86_Switch_VT_3> [list searchbar::find_prev $finder] }
git-gui/lib/search.tcl +3 -1
@@ -35,6 +35,8 @@ constructor new {i_w i_text args} { grid remove $w trace add variable searchstring write [cb _incrsearch_cb] + bind $w.ent <Return> [cb find_next] + bind $w.ent <Shift-Return> [cb find_prev] bind $w <Destroy> [list delete_this $this] return $this
@@ -196,4 +198,4 @@ method scrolled {} { } } -} +}
Signature · 1 line
1.7.2.5
Quoted 7 lines · David Fries
add slash and Control-S to bring up search
enter, n, Shift-Enter, Shift-n to to go the next and previous entriessearch hotkey return is
find_nextshift prevSigned-off-by David Fries <[email protected]>
Thank you for this. It looks like a useful feature and I'll apply this to git-gui with some modifications. Note that Paul Mackerras is the maintainer of gitk not git-gui.
It is worth putting a bit more detail into the commit message as in general that is all the context a maintainer has to decide what the patch is doing and how it should be tested. In this case I'll replace it with the following:
git-gui: Add keyboard shortcuts for search and goto commands in blame view.
Use forward-slash or Control-S to bring up the search dialog. In the blame view, Enter or 'n' jump to the next selected region while
Shift-Enter or Shift-n will jump to the previous selected region. Within the search control, hitting Enter will now jump to the next matching
region.
That aside, the goto-line feature works fine for me. I don't think the n, Shift-n binding is working though. When I have the focus in the blame window and enter 'n' it tries to add an 'n' to the text in the search box. The use of Enter and Shift-Enter makes sense and works as I expect. So I will drop the 'n' and 'Shift-n' bindings I think.
The -accelerator field on a menu specifies the text to show. Its more usual to show "Ctrl-G" than "Control-Key-G" here so I'll adjust that as well. The 'bind' command actually ties up the key binding to the menu action.
With the above changes, I'll apply this to git-gui's master (which lives at repo.or.cz/git-gui.git) and it will get merged into git on the next merge.
Cheers,
Pat Thoyts
Signature · 2 lines
Pat Thoyts http://www.patthoyts.tk/ PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
Quoted 7 lines · Pat Thoyts
David Fries <[email protected]> writes:
That aside, the goto-line feature works fine for me. I don't think the n, Shift-n binding is working though. When I have the focus in the blame window and enter 'n' it tries to add an 'n' to the text in the search box. The use of Enter and Shift-Enter makes sense and works as I expect. So I will drop the 'n' and 'Shift-n' bindings I think.
I have some 6000 some line files that I was preparing change sets and was needing to jump to a specific line. That's what prompted me to add the goto feature, I just went ahead and added the search hotkeys while I was in looking at it. I apparently didn't do enough testing on the search, it's <Key-N> not the <Shift-Key-n> that I had in there. The n and N only work when the search bar is dismissed with escape or something. I'm more used to vi's searching where the search field is dismissed with return and there isn't a search field left to add to. I'm fine with dropping the n/N bindings.
Quoted 8 lines
The -accelerator field on a menu specifies the text to show. Its more usual to show "Ctrl-G" than "Control-Key-G" here so I'll adjust that as well. The 'bind' command actually ties up the key binding to the menu action.
With the above changes, I'll apply this to git-gui's master (which lives at repo.or.cz/git-gui.git) and it will get merged into git on the next merge.
Sounds good, thanks for merging it.
Signature · 2 lines
David Fries <[email protected]> PGP pub CB1EE8F0 http://fries.net/~david/