From: Johannes Sixt Date: Wed, 05 Jul 2023 19:52:17 GMT Subject: Re: [PATCH v2 09/10] gitk: improve keyboard convenience in reset dialog Message-ID: In-Reply-To: Am 03.07.23 um 20:45 schrieb Jens Lidestrom via GitGitGadget: > From: Jens Lidestrom > > Make it more convenient to use the reset dialog using keyboard. > > * Set focus to the combo box. > * Accept with Return key. > * Auto-select combo items when navigating in menu with up/down keys. I like it! > > Signed-off-by: Jens Lidestrom > --- > gitk-git/gitk | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/gitk-git/gitk b/gitk-git/gitk > index f559e279b7a..fafff2b1a5b 100755 > --- a/gitk-git/gitk > +++ b/gitk-git/gitk > @@ -9902,27 +9902,40 @@ proc resethead {reset_target_id} { > ttk_toplevel $w > make_transient $w . > wm title $w [mc "Confirm reset"] > + > ${NS}::label $w.m -text \ > [mc "Reset branch %s to %s?" $mainhead [commit_name $reset_target_id 1]] > pack $w.m -side top -fill x -padx 20 -pady 20 > ${NS}::labelframe $w.f -text [mc "Reset type:"] > + > set resettype mixed > + > ${NS}::radiobutton $w.f.soft -value soft -variable resettype \ > -text [mc "Soft: Leave working tree and index untouched"] > + bind $w.f.soft "set resettype hard" > + bind $w.f.soft "set resettype mixed" > grid $w.f.soft -sticky w > + > ${NS}::radiobutton $w.f.mixed -value mixed -variable resettype \ > -text [mc "Mixed: Leave working tree untouched, reset index"] > + bind $w.f.mixed "set resettype soft" > + bind $w.f.mixed "set resettype hard" > grid $w.f.mixed -sticky w > + > ${NS}::radiobutton $w.f.hard -value hard -variable resettype \ > -text [mc "Hard: Reset working tree and index\n(discard ALL local changes)"] > + bind $w.f.hard "set resettype mixed" > + bind $w.f.hard "set resettype soft" > grid $w.f.hard -sticky w > pack $w.f -side top -fill x -padx 4 > + > ${NS}::button $w.ok -text [mc OK] -command "set confirm_ok 1; destroy $w" > + bind $w "set confirm_ok 1; destroy $w" > pack $w.ok -side left -fill x -padx 20 -pady 20 > ${NS}::button $w.cancel -text [mc Cancel] -command "destroy $w" > bind $w [list destroy $w] > pack $w.cancel -side right -fill x -padx 20 -pady 20 > - bind $w "grab $w; focus $w" > + bind $w "grab $w; focus $w.f.mixed" > tkwait window $w > if {!$confirm_ok} return > if {[catch {set fd [open \