git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] git-gui blame add more common search hotkeys
@ 2011-07-16 16:59 David Fries
  2011-07-19 14:35 ` Pat Thoyts
  0 siblings, 1 reply; 3+ messages in thread
From: David Fries @ 2011-07-16 16:59 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras

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

Signed-off-by: David Fries <David@Fries.net>

---
 git-gui/lib/blame.tcl  |    4 ++++
 git-gui/lib/search.tcl |    4 +++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl
index 062091b..cc8c0ba 100644
--- a/git-gui/lib/blame.tcl
+++ b/git-gui/lib/blame.tcl
@@ -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] }
 
diff --git a/git-gui/lib/search.tcl b/git-gui/lib/search.tcl
index 7fdbf87..ef3486f 100644
--- a/git-gui/lib/search.tcl
+++ b/git-gui/lib/search.tcl
@@ -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 {} {
 	}
 }
 
-}
\ No newline at end of file
+}
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] git-gui blame add more common search hotkeys
  2011-07-16 16:59 [PATCH 2/2] git-gui blame add more common search hotkeys David Fries
@ 2011-07-19 14:35 ` Pat Thoyts
  2011-07-20  2:56   ` David Fries
  0 siblings, 1 reply; 3+ messages in thread
From: Pat Thoyts @ 2011-07-19 14:35 UTC (permalink / raw)
  To: David Fries; +Cc: git, Paul Mackerras

David Fries <david@fries.net> writes:

>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
>
>Signed-off-by: David Fries <David@Fries.net>
>

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.

   Signed-off-by: David Fries <David@Fries.net>
   Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

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

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] git-gui blame add more common search hotkeys
  2011-07-19 14:35 ` Pat Thoyts
@ 2011-07-20  2:56   ` David Fries
  0 siblings, 0 replies; 3+ messages in thread
From: David Fries @ 2011-07-20  2:56 UTC (permalink / raw)
  To: Pat Thoyts; +Cc: git

On Tue, Jul 19, 2011 at 03:35:30PM +0100, Pat Thoyts wrote:
> David Fries <david@fries.net> 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.

> 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.

-- 
David Fries <david@fries.net>    PGP pub CB1EE8F0
http://fries.net/~david/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-20  2:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-16 16:59 [PATCH 2/2] git-gui blame add more common search hotkeys David Fries
2011-07-19 14:35 ` Pat Thoyts
2011-07-20  2:56   ` David Fries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).