threads / patch / 53451

v3git-gui: Handle Ctrl + BS/Del in the commit msg

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

## tl;dr

4 messages between May 12, 2020 and May 21, 2020. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Ismael Luceno· May 12, 2020, 10:28 UTC · lore
From: Ismael Luceno <ismael.luceno@tttech-auto.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@tttech-auto.com>

--- I'm re-submitting the patch after >1 year.

CC: Junio C Hamano <gitster@pobox.com>
CC: "brian m. carlson" <sandals@crustytoothpaste.net>
CC: Pat Thoyts <patthoyts@users.sourceforge.net>
CC: Johannes Schindelin <Johannes.Schindelin@gmx.de>
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(+)
Show changes to git-gui/git-gui.sh +2 −0
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
Pratyush Yadav· May 12, 2020, 13:02 UTC · re: Ismael Luceno · lore

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

Hi Ismael,
On 12/05/20 12:28PM, Ismael Luceno wrote:
Show 49 quoted lines
> From: Ismael Luceno <ismael.luceno@tttech-auto.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@tttech-auto.com>
> 
> ---
> I'm re-submitting the patch after >1 year.
> 
> CC: Junio C Hamano <gitster@pobox.com>
> CC: "brian m. carlson" <sandals@crustytoothpaste.net>
> CC: Pat Thoyts <patthoyts@users.sourceforge.net>
> CC: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> 
> 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

You based the patch on top of the Git tree. Since Git Gui is maintained separate from Git, patches are expected to be based on top of the Git Gui tree [0]. I fixed it up and applied the patch on my tree.

Show 6 quoted lines
> @@ -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}

Don't use "Control" directly to maintain compatibility with MacOS. Use $M1B like the surrounding code does. I fixed it up locally, so no need to send in a new version. You can find the fixed up version here [1]. Test it if you'd like.

Will merge it in. Thanks.
  
[0] https://github.com/prati0100/git-gui/
[1] https://github.com/prati0100/git-gui/tree/il/ctrl-bs-del
-- 
Regards,
Pratyush Yadav
Ismael Luceno· May 12, 2020, 13:28 UTC · re: Pratyush Yadav · lore

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

On 12/May/2020 18:32, Pratyush Yadav wrote:
Show 70 quoted lines
> Hi Ismael,
> 
> On 12/05/20 12:28PM, Ismael Luceno wrote:
> > From: Ismael Luceno <ismael.luceno@tttech-auto.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@tttech-auto.com>
> > 
> > ---
> > I'm re-submitting the patch after >1 year.
> > 
> > CC: Junio C Hamano <gitster@pobox.com>
> > CC: "brian m. carlson" <sandals@crustytoothpaste.net>
> > CC: Pat Thoyts <patthoyts@users.sourceforge.net>
> > CC: Johannes Schindelin <Johannes.Schindelin@gmx.de>
> > 
> > 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
> 
> You based the patch on top of the Git tree. Since Git Gui is maintained 
> separate from Git, patches are expected to be based on top of the Git 
> Gui tree [0]. I fixed it up and applied the patch on my tree.
> 
> > @@ -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}
> 
> Don't use "Control" directly to maintain compatibility with MacOS. Use 
> $M1B like the surrounding code does. I fixed it up locally, so no need 
> to send in a new version. You can find the fixed up version here [1]. 
> Test it if you'd like.
> 
> Will merge it in. Thanks.
Thanks.
Pratyush Yadav· May 21, 2020, 13:00 UTC · re: Ismael Luceno · lore

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

On 12/05/20 12:28PM, Ismael Luceno wrote:
Show 25 quoted lines
> From: Ismael Luceno <ismael.luceno@tttech-auto.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@tttech-auto.com>
Merged to git-gui/master.
 
-- 
Regards,
Pratyush Yadav

← back to recent threads