Clear the SHA1 entry field when we go to paste something into it

If the user pastes in the selection (with the middle mouse button) and
it already has 40 characters in it, clear it before pasting.
This commit is contained in:
Paul Mackerras
2005-06-25 16:37:13 +10:00
parent c8dfbcf995
commit ee3dc72e30

8
gitk
View File

@ -398,6 +398,7 @@ proc makewindow {} {
bind . <Button-1> "click %W" bind . <Button-1> "click %W"
bind $fstring <Key-Return> dofind bind $fstring <Key-Return> dofind
bind $sha1entry <Key-Return> gotocommit bind $sha1entry <Key-Return> gotocommit
bind $sha1entry <<PasteSelection>> clearsha1
set maincursor [. cget -cursor] set maincursor [. cget -cursor]
set textcursor [$ctext cget -cursor] set textcursor [$ctext cget -cursor]
@ -1566,6 +1567,13 @@ proc incrfont {inc} {
redisplay redisplay
} }
proc clearsha1 {} {
global sha1entry sha1string
if {[string length $sha1string] == 40} {
$sha1entry delete 0 end
}
}
proc sha1change {n1 n2 op} { proc sha1change {n1 n2 op} {
global sha1string currentid sha1but global sha1string currentid sha1but
if {$sha1string == {} if {$sha1string == {}