# [PATCH v3] git-gui: Handle Ctrl + BS/Del in the commit msg

3 messages from 2019-04-08 to 2019-05-27. Participants: Ismael Luceno Cortes, Ismael Luceno, Johannes Schindelin.
Thread: https://gitlist.dev/t/50894

## Ismael Luceno Cortes, 2019-04-08 12:54

Subject: [PATCH v3] git-gui: Handle Ctrl + BS/Del in the commit msg
Message-ID: <20190408125406.16703-1-ismael.luceno@silicon-gears.com>
URL: https://gitlist.dev/e/20190408125406.16703-1-ismael.luceno%40silicon-gears.com

```
- Control+BackSpace: Delete word to the left of the cursor.
- Control+Delete   : Delete word to the right of the cursor.

Originally introduced by BRIEF and Turbo Vision between 1985 and 1992,
they were adopted by most CUA-Compliant UIs, including those of: OS/2,
Windows, Mac OS, Qt, GTK, Open/Libre Office, Gecko, and GNU Emacs.

In both cases Tk already implements the functionality bound to other key
combination, so we use that.

Graphical examples:

Deleting to the left:
        v------ pointer
X_WORD____X
  ^-----^------ selection

Deleting to the right:
  v--------- pointer
X_WORD_X
  ^--^------ selection

Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>

---

CC: Junio C Hamano <gitster@pobox.com>
CC: "brian m. carlson" <sandals@crustytoothpaste.net>
CC: Pat Thoyts <patthoyts@users.sourceforge.net>

Notes:
    Changes since v2:
    - Reimplemented via existing events, which correctly delete spaces.
    - Further improved commit message.
    
    Changes since v1:
    - Improved commit message.

 git-gui/git-gui.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 6de74ce639..c4e0270626 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -3812,6 +3812,8 @@ bind $ui_comm <$M1B-Key-KP_Subtract> {show_less_context;break}
 bind $ui_comm <$M1B-Key-equal> {show_more_context;break}
 bind $ui_comm <$M1B-Key-plus> {show_more_context;break}
 bind $ui_comm <$M1B-Key-KP_Add> {show_more_context;break}
+bind $ui_comm <Control-Key-BackSpace> {event generate %W <Meta-Delete>;break}
+bind $ui_comm <Control-Key-Delete> {event generate %W <Meta-d>;break}
 
 bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}
 bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}
-- 
2.19.1

```

## Ismael Luceno, 2019-05-06 14:41

Subject: Re: [PATCH v3] git-gui: Handle Ctrl + BS/Del in the commit msg
Message-ID: <20190506144122.GE4920@kiki>
URL: https://gitlist.dev/e/20190506144122.GE4920%40kiki
In-Reply-To: <20190408125406.16703-1-ismael.luceno@silicon-gears.com>

```
On 08/Apr/2019 12:54, Ismael Luceno Cortes wrote:
> - Control+BackSpace: Delete word to the left of the cursor.
> - Control+Delete   : Delete word to the right of the cursor.
> 
> Originally introduced by BRIEF and Turbo Vision between 1985 and 1992,
> they were adopted by most CUA-Compliant UIs, including those of: OS/2,
> Windows, Mac OS, Qt, GTK, Open/Libre Office, Gecko, and GNU Emacs.
> 
> In both cases Tk already implements the functionality bound to other key
> combination, so we use that.
<...>

Ping.

```

## Johannes Schindelin, 2019-05-27 19:37

Subject: Re: [PATCH v3] git-gui: Handle Ctrl + BS/Del in the commit msg
Message-ID: <nycvar.QRO.7.76.6.1905272135280.28524@tvgsbejvaqbjf.bet>
URL: https://gitlist.dev/e/nycvar.QRO.7.76.6.1905272135280.28524%40tvgsbejvaqbjf.bet
In-Reply-To: <20190506144122.GE4920@kiki>

```
Hi,

On Mon, 6 May 2019, Ismael Luceno wrote:

> On 08/Apr/2019 12:54, Ismael Luceno Cortes wrote:
> > - Control+BackSpace: Delete word to the left of the cursor.
> > - Control+Delete   : Delete word to the right of the cursor.
> >
> > Originally introduced by BRIEF and Turbo Vision between 1985 and 1992,
> > they were adopted by most CUA-Compliant UIs, including those of: OS/2,
> > Windows, Mac OS, Qt, GTK, Open/Libre Office, Gecko, and GNU Emacs.
> >
> > In both cases Tk already implements the functionality bound to other key
> > combination, so we use that.
> <...>
>
> Ping.

FWIW I am in favor of this patch. It is simple enough, and the commit
message does a good job explaining why it is a good idea to do it.

It's too bad that we do not have any active Git GUI maintainer... :-(

Ciao,
Johannes

```
