threads / patch / 52486

v2git-gui: allow closing console window with Escape

Subject: [PATCH v2] git-gui: allow closing console window with Escape

## tl;dr

2 messages between Dec 18, 2019 and Dec 22, 2019. Diffs are folded; open one to read it.

replies: 1people: 1as markdown or json

Pratyush Yadav· Dec 18, 2019, 19:58 UTC · lore

This gives users a quick shortcut to close the window. But since the window can also show commands in progress, closing the window on Escape can give the perception that the command has been cancelled even though it hasn't been. So, only enable this binding when the command is done.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
---
Changes in v2:
- Only allow closing the window on Escape when the command is done.
 lib/console.tcl | 2 ++
 1 file changed, 2 insertions(+)
Show changes to lib/console.tcl +2 −1
diff --git a/lib/console.tcl b/lib/console.tcl
index 1f3248f..bb6b9c8 100644
--- a/lib/console.tcl
+++ b/lib/console.tcl
@@ -203,6 +203,8 @@ method done {ok} {
 			focus $w.ok
 		}
 	}
+
+	bind $w <Key-Escape> "destroy $w;break"
 }

 method _sb_set {sb orient first last} {
--
2.24.1
Pratyush Yadav· Dec 22, 2019, 09:59 UTC · re: Pratyush Yadav · lore

Re: [PATCH v2] git-gui: allow closing console window with Escape

On 19/12/19 01:28AM, Pratyush Yadav wrote:
Show 6 quoted lines
> This gives users a quick shortcut to close the window. But since the
> window can also show commands in progress, closing the window on Escape
> can give the perception that the command has been cancelled even though
> it hasn't been. So, only enable this binding when the command is done.
> 
> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
Merged to 'master'.
-- 
Regards,
Pratyush Yadav

← back to recent threads