Skip to contentSkip to conversation

gitk: map / to focus the search box

PATCH In review Giuseppe Bilotta 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitk: map / to focus the search box

The / key is often used to initiate searches (less, vim, some web browsers). We change the binding for the / (slash) key from 'find next' to 'focus the search box' to follow this convention.

---
 gitk-git/gitk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
gitk-git/gitk +1 -1
index 6b671a6..8b60632 100644
@@ -2271,7 +2271,7 @@ proc makewindow {} {
     bindkey b prevfile
     bindkey d "$ctext yview scroll 18 units"
     bindkey u "$ctext yview scroll -18 units"
-    bindkey / {dofind 1 1}
+    bindkey / {focus $fstring}
     bindkey <Key-Return> {dofind 1 1}
     bindkey ? {dofind -1 1}
     bindkey f nextfile
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 3 lines · Giuseppe Bilotta

The / key is often used to initiate searches (less, vim, some web browsers). We change the binding for the / (slash) key from 'find next' to 'focus the search box' to follow this convention.

I think that's reasonable, but the patch needs to update the key bindings help text as well.

Thanks,
Paul.

#2 lore raw

PATCH 1/1 gitk: map / to focus the search box

The / key is often used to initiate searches (less, vim, some web browsers). We change the binding for the / (slash) key from 'find next' to 'focus the search box' to follow this convention.

---

Like this?

 gitk-git/gitk |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
gitk-git/gitk +2 -2
index 6b671a6..0c0350b 100644
@@ -2271,7 +2271,7 @@ proc makewindow {} {
     bindkey b prevfile
     bindkey d "$ctext yview scroll 18 units"
     bindkey u "$ctext yview scroll -18 units"
-    bindkey / {dofind 1 1}
+    bindkey / {focus $fstring}
     bindkey <Key-Return> {dofind 1 1}
     bindkey ? {dofind -1 1}
     bindkey f nextfile
@@ -2652,7 +2652,7 @@ proc keys {} {
 [mc "<%s-F>		Find" $M1T]
 [mc "<%s-G>		Move to next find hit" $M1T]
 [mc "<Return>	Move to next find hit"]
-[mc "/		Move to next find hit, or redo find"]
+[mc "/		Focus the search box"]
 [mc "?		Move to previous find hit"]
 [mc "f		Scroll diff view to next file"]
 [mc "<%s-S>		Search for next hit in diff view" $M1T]
Signature · 1 line
1.5.6.5