git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ismael Luceno <ismael@iodev.co.uk>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Pat Thoyts <patthoyts@users.sourceforge.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH v3] git-gui: Handle Ctrl + BS/Del in the commit msg
Date: Tue, 12 May 2020 12:28:06 +0200	[thread overview]
Message-ID: <20200512102806.GA20813@abuya.home> (raw)

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
@@ -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

             reply	other threads:[~2020-05-12 10:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 10:28 Ismael Luceno [this message]
2020-05-12 13:02 ` [PATCH v3] git-gui: Handle Ctrl + BS/Del in the commit msg Pratyush Yadav
2020-05-12 13:28   ` Ismael Luceno
2020-05-21 13:00 ` Pratyush Yadav
  -- strict thread matches above, loose matches on Subject: below --
2019-04-08 12:54 Ismael Luceno Cortes
2019-05-06 14:41 ` Ismael Luceno
2019-05-27 19:37   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200512102806.GA20813@abuya.home \
    --to=ismael@iodev.co.uk \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=patthoyts@users.sourceforge.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).