I updated the implementation to use "mixed" as the default, but allow switching selected item with up and down keys, and accept with enter. It works fine! :) /Jens On 2023-06-28 09:16, Jens Lideström wrote: >> I would prefer to keep the default at "mixed" mode, set the focus on the >> radio button to make it easy to switch to "hard" mode by hitting the >> Down arrow key, and then make it so that Enter triggers the OK button. > > That indeed sounds better! Safer but still convenient. I'll change the solution > to this. > > I noticed that some dialogues have a key bind to close with success using Enter. > > /Jens > > > On 2023-06-28 07:46, Johannes Sixt wrote: >> Am 27.06.23 um 16:41 schrieb Jens Lidestrom via GitGitGadget: >>> From: Jens Lidestrom <jens@xxxxxxxxxxxx> >>> >>> Reset hard is dangerous but also the most common reset type, and not >>> having it pre-selected in the dialog is annoying to users. >> >> I agree that the operation of the Reset dialog is clumsy before this >> series. However, this patch together with the previous patch turns it >> into a foot gun. It becomes far too easy to destroy uncommitted work. >> >> I would prefer to keep the default at "mixed" mode, set the focus on the >> radio button to make it easy to switch to "hard" mode by hitting the >> Down arrow key, and then make it so that Enter triggers the OK button. >> >>> It is also less dangerous in the GUI where there is a confirmation >>> dialog. Also, dangling commits remain in the GUI and can be recovered. >> >> The problem with "hard" mode are not the commits. The real danger is >> that it blows away uncommitted changes. Besides of that, I do not >> consider this UI a confirmation dialog. >> >> -- Hannes >> >>> >>> Signed-off-by: Jens Lidestrom <jens@xxxxxxxxxxxx> >>> --- >>> gitk-git/gitk | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/gitk-git/gitk b/gitk-git/gitk >>> index 9d93053e360..5b0a0ea46be 100755 >>> --- a/gitk-git/gitk >>> +++ b/gitk-git/gitk >>> @@ -9906,7 +9906,9 @@ proc resethead {reset_target_id} { >>> [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 >>> + # Reset hard is dangerous but also the most common reset type, and not >>> + # having it pre-selected in the dialog is annoying to users. >>> + set resettype hard >>> ${NS}::radiobutton $w.f.soft -value soft -variable resettype \ >>> -text [mc "Soft: Leave working tree and index untouched"] >>> grid $w.f.soft -sticky w