{"thread":{"id":"27828","subject":"[PATCH 2/2] git-gui blame add more common search hotkeys","startedAt":"2011-07-16T16:59:45Z","lastAt":"2011-07-20T02:56:01Z","messageCount":3,"participants":["David Fries","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"171485","messageId":"20110716165945.GA9722@spacedout.fries.net","threadId":"27828","inReplyTo":null,"subject":"[PATCH 2/2] git-gui blame add more common search hotkeys","fromName":"David Fries","fromEmail":"david@fries.net","sentAt":"2011-07-16T16:59:45Z","receivedAt":"2011-07-16T16:59:45Z","isPatch":true,"sender":{"key":"david@fries.net","avatar":"https://avatars.githubusercontent.com/u/2767875?v=4"},"body":"add slash and Control-S to bring up search\nenter, n, Shift-Enter, Shift-n to to go the next and previous entries\n\nsearch hotkey return is find_next shift prev\n\nSigned-off-by: David Fries <David@Fries.net>\n\n---\n git-gui/lib/blame.tcl  |    4 ++++\n git-gui/lib/search.tcl |    4 +++-\n 2 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl\nindex 062091b..cc8c0ba 100644\n--- a/git-gui/lib/blame.tcl\n+++ b/git-gui/lib/blame.tcl\n@@ -352,9 +352,13 @@ constructor new {i_commit i_path i_jump} {\n \tbind $w_cviewer <Button-1>   [list focus $w_cviewer]\n \tbind $w_file    <Visibility> [cb _focus_search $w_file]\n \tbind $top       <F7>         [list searchbar::show $finder]\n+\tbind $top       <Key-slash>  [list searchbar::show $finder]\n+\tbind $top    <Control-Key-s> [list searchbar::show $finder]\n \tbind $top       <Escape>     [list searchbar::hide $finder]\n \tbind $top       <F3>         [list searchbar::find_next $finder]\n+\tbind $top       <Key-n>      [list searchbar::find_next $finder]\n \tbind $top       <Shift-F3>   [list searchbar::find_prev $finder]\n+\tbind $top    <Shift-Key-n>   [list searchbar::find_prev $finder]\n \tbind $top    <Control-Key-g> [list linebar::show $gotoline]\n \tcatch { bind $top <Shift-Key-XF86_Switch_VT_3> [list searchbar::find_prev $finder] }\n \ndiff --git a/git-gui/lib/search.tcl b/git-gui/lib/search.tcl\nindex 7fdbf87..ef3486f 100644\n--- a/git-gui/lib/search.tcl\n+++ b/git-gui/lib/search.tcl\n@@ -35,6 +35,8 @@ constructor new {i_w i_text args} {\n \tgrid remove $w\n \n \ttrace add variable searchstring write [cb _incrsearch_cb]\n+\tbind $w.ent <Return> [cb find_next]\n+\tbind $w.ent <Shift-Return> [cb find_prev]\n \t\n \tbind $w <Destroy> [list delete_this $this]\n \treturn $this\n@@ -196,4 +198,4 @@ method scrolled {} {\n \t}\n }\n \n-}\n\\ No newline at end of file\n+}\n-- \n1.7.2.5\n"},{"id":"171657","messageId":"87sjq2cp8t.fsf@fox.patthoyts.tk","threadId":"27828","inReplyTo":"20110716165945.GA9722@spacedout.fries.net","subject":"Re: [PATCH 2/2] git-gui blame add more common search hotkeys","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-07-19T14:35:30Z","receivedAt":"2011-07-19T14:35:30Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"David Fries <david@fries.net> writes:\n\n>add slash and Control-S to bring up search\n>enter, n, Shift-Enter, Shift-n to to go the next and previous entries\n>\n>search hotkey return is find_next shift prev\n>\n>Signed-off-by: David Fries <David@Fries.net>\n>\n\nThank you for this. It looks like a useful feature and I'll apply this\nto git-gui with some modifications. Note that Paul Mackerras is the\nmaintainer of gitk not git-gui.\n\nIt is worth putting a bit more detail into the commit message as in\ngeneral that is all the context a maintainer has to decide what the\npatch is doing and how it should be tested. In this case I'll replace it\nwith the following:\n\n   git-gui: Add keyboard shortcuts for search and goto commands in blame\n   view.\n\n   Use forward-slash or Control-S to bring up the search dialog.\n   In the blame view, Enter or 'n' jump to the next selected region\n   while\n   Shift-Enter or Shift-n will jump to the previous selected region.\n   Within the search control, hitting Enter will now jump to the next\n   matching\n   region.\n\n   Signed-off-by: David Fries <David@Fries.net>\n   Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n\nThat aside, the goto-line feature works fine for me. I don't think the\nn, Shift-n binding is working though. When I have the focus in the blame\nwindow and enter 'n' it tries to add an 'n' to the text in the search\nbox. The use of Enter and Shift-Enter makes sense and works as I\nexpect. So I will drop the 'n' and 'Shift-n' bindings I think.\n\nThe -accelerator field on a menu specifies the text to show. Its more\nusual to show \"Ctrl-G\" than \"Control-Key-G\" here so I'll adjust that as\nwell. The 'bind' command actually ties up the key binding to the menu\naction.\n\nWith the above changes, I'll apply this to git-gui's master (which lives\nat repo.or.cz/git-gui.git) and it will get merged into git on the next\nmerge.\n\nCheers,\nPat Thoyts\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"},{"id":"171715","messageId":"20110720025601.GE26701@spacedout.fries.net","threadId":"27828","inReplyTo":"87sjq2cp8t.fsf@fox.patthoyts.tk","subject":"Re: [PATCH 2/2] git-gui blame add more common search hotkeys","fromName":"David Fries","fromEmail":"david@fries.net","sentAt":"2011-07-20T02:56:01Z","receivedAt":"2011-07-20T02:56:01Z","isPatch":true,"sender":{"key":"david@fries.net","avatar":"https://avatars.githubusercontent.com/u/2767875?v=4"},"body":"On Tue, Jul 19, 2011 at 03:35:30PM +0100, Pat Thoyts wrote:\n> David Fries <david@fries.net> writes:\n> \n> That aside, the goto-line feature works fine for me. I don't think the\n> n, Shift-n binding is working though. When I have the focus in the blame\n> window and enter 'n' it tries to add an 'n' to the text in the search\n> box. The use of Enter and Shift-Enter makes sense and works as I\n> expect. So I will drop the 'n' and 'Shift-n' bindings I think.\n\nI have some 6000 some line files that I was preparing change sets\nand was needing to jump to a specific line.  That's what prompted me\nto add the goto feature, I just went ahead and added the search\nhotkeys while I was in looking at it.  I apparently didn't do enough\ntesting on the search, it's <Key-N> not the <Shift-Key-n> that I had\nin there.  The n and N only work when the search bar is dismissed with\nescape or something.  I'm more used to vi's searching where the search\nfield is dismissed with return and there isn't a search field left to\nadd to.  I'm fine with dropping the n/N bindings.\n\n> The -accelerator field on a menu specifies the text to show. Its more\n> usual to show \"Ctrl-G\" than \"Control-Key-G\" here so I'll adjust that as\n> well. The 'bind' command actually ties up the key binding to the menu\n> action.\n> \n> With the above changes, I'll apply this to git-gui's master (which lives\n> at repo.or.cz/git-gui.git) and it will get merged into git on the next\n> merge.\n\nSounds good, thanks for merging it.\n\n-- \nDavid Fries <david@fries.net>    PGP pub CB1EE8F0\nhttp://fries.net/~david/\n"}]}