mintty icon indicating copy to clipboard operation
mintty copied to clipboard

Feature request: Add a confirm dialog before resetting terminal screen

Open danowar2k opened this issue 3 years ago • 2 comments

I've just accidentally resetted my output when I wanted to click on Search but accidentally clicked on Reset in the context menu.

Would you be so kind as to add a confirm dialog before resetting the terminal?

danowar2k avatar Oct 05 '22 20:10 danowar2k

As xterm also has a Reset menu entry, unguarded function but better separated in the menu, would it be sufficient to add another separator line between Search and Reset?

mintty avatar Oct 06 '22 10:10 mintty

I don't know, I can be awfully quick with clicking :-/

danowar2k avatar Oct 06 '22 11:10 danowar2k

Released 3.6.2.

mintty avatar Nov 14 '22 13:11 mintty

Thank you very much!

danowar2k avatar Nov 14 '22 14:11 danowar2k

Add the following line or modify the KeyFunctions setting in your .minttyrc file if you'd like to restore the previous Alt+F8 hotkey behavior (reset the terminal with no confirmation dialog). See the mintty manpage for more information.

KeyFunctions=A+F8:reset-noask

ksufinger avatar Jan 26 '23 20:01 ksufinger

Adding KeyFunctions=A+F8:reset-noask just disables resetting the terminal screen, how I can really get the original behaviour?

dortamiguel avatar Feb 04 '23 22:02 dortamiguel

It was quite annoying to get this changed by default...

(apparently deleted) I'm sorry, a change is really rare but I thought the argument was quite convincing. Open to discussion though. (Note: Another change that I considered but didn't do was to enable Control as a Compose key be default...)

The KeyFunctions assignment works here, puzzled about that; does Control+V Alt+F8 report anything? Please upload your full config file.

mintty avatar Feb 05 '23 08:02 mintty

I think is fine no worries, I thought I broke something because I got that message. But it seems like an easy fix, though it seems to not work for me...

this my config now

Font=SF Mono
FontHeight=15
FontWeight=400
FontIsBold=no
BellType=0
BellTaskbar=no
ConfirmExit=no
CursorType=block
ClipShortcuts=yes
CopyOnSelect=no
CopyAsRTF=no
TrimSelection=no
ClearSelectionOnInput=no

CursorColour=255,180,116
BackgroundColour=44,70,97
ForegroundColour=255,255,255
Black=0,0,0
BoldBlack=126,126,127
Red=255,101,80
BoldRed=241,94,75
Green=115,255,186
BoldGreen=108,243,178
Yellow=255,160,81
BoldYellow=242,152,77
Blue=94,203,255
BoldBlue=92,192,243
Magenta=235,176,255
BoldMagenta=255,168,243
Cyan=163,221,254
BoldCyan=156,208,243
White=255,255,255
BoldWhite=255,255,255

dortamiguel avatar Feb 05 '23 22:02 dortamiguel

That config does not contain a KeyFunctions setting, so it cannot work.

mintty avatar Feb 05 '23 23:02 mintty

Ah sorry, I forgot to say that when I add KeyFunctions=A+F8:reset-noask is when it stops working.

Without that line I get the confirmation message, with that line nothing happens

dortamiguel avatar Feb 06 '23 19:02 dortamiguel

So Alt+F8 does not clear your screen? I have no idea why.

mintty avatar Feb 06 '23 20:02 mintty

It clears the screen if I don't add the KeyFunctions=A+F8:reset-noask but then I get the dialog confirmation

dortamiguel avatar Feb 06 '23 20:02 dortamiguel

Did you, by any chance, manage to put a Windows lineend (CRLF) behind that line? Try to add a semicolon to its end: KeyFunctions=A+F8:reset-noask;

mintty avatar Feb 06 '23 22:02 mintty

Does the semicolon help?

mintty avatar Feb 14 '23 08:02 mintty

Is there any chance we can revert this or make the default to be no confirm and otherwise provide an option for people who want that type of thing? I find myself using the "reset terminal" feature quite a bit and it's a bit jarring to flip expected behavior just because one person made a non-fatal mistake once. And yeah, I could just use the keyboard shortcut, which I'm slowly reversing muscle memory for, but it's more about the principle of adding interactivity to something that just simply does not need it and slows people down 99% of the time for the 1% odd case.

clayne avatar Apr 03 '23 19:04 clayne

Please don't revert, but I'm totally okay with the default being not to ask and it being a config or UI setting :-)

danowar2k avatar Apr 04 '23 09:04 danowar2k

Yes, I think it's fine to offer a UI option - but IMO to immediately slap a safety guard on something because 0.1% of the userbase shot themselves in the foot with it isn't the right approach. That's turtles all the way down.

clayne avatar Apr 04 '23 15:04 clayne

It's a safety net for 99% of the users who did not mean to invoke a terminal reset, and for which it is likely to make no difference. But in most cases, we never want a reset to occur without confirmation, otherwise it could be used by malicious code. If someone clicks or presses enter without thinking or reading, that is not our issue, nor if someone wants to allow code to reset their terminal indiscriminately: not a safe approach!

BrianInglis avatar Apr 04 '23 20:04 BrianInglis

This is about a GUI dialog option asking for confirm - not about "malicious code" resetting the terminal, of which I'm pretty sure the added confirm dialog isn't even involved with. It's a safety net optimizing for a scenario where a user clicks "Reset Terminal" in a specific context menu that they pulled up and 0.1% of the time that not actually being what they wanted to do - where the "negative" cost of that happening is merely that their scrollback buffer was cleared - a completely non-destructive situation. Meanwhile the majority of people who intentionally use it to clear scrollback buffers now have to mindlessly grab the mouse and click on a newly added confirm dialog that in the grand scheme of things is likely costing people more time than it's saving them from.

clayne avatar Apr 04 '23 22:04 clayne

You people should cool down, the current tone is very unfriendly...

danowar2k avatar Apr 05 '23 07:04 danowar2k

Clear scrollback is also available as a separate menu item, by the way. I do intend to add an option, surprisingly it's just a bit tricky due to the way this is implemented in mintty. Design issues: Should there be separate configuration (bits) for Alt+F8 and Ctrl+Shift+R? What should be the default?

mintty avatar Apr 06 '23 07:04 mintty

Release 3.6.5.

mintty avatar Sep 03 '23 10:09 mintty