# [PATCH] git-gui: Fix semi-working shortcuts for unstage and revert

3 messages from 2012-09-14 to 2012-09-17. Participants: vi0oss@gmail.com, Bert Wesarg, Pat Thoyts.
Thread: https://gitlist.dev/t/31536

## vi0oss@gmail.com, 2012-09-14 23:36

Subject: [PATCH] git-gui: Fix semi-working shortcuts for unstage and revert
Message-ID: <1347665801-22634-1-git-send-email-vi0oss@gmail.com>
URL: https://gitlist.dev/e/1347665801-22634-1-git-send-email-vi0oss%40gmail.com

```
From: Vitaly _Vi Shukela <vi0oss@gmail.com>

Make Ctrl+U for unstaging and Ctrl+J for reverting selection behave
more like Ctrl+T for adding.

They were working only when one area was focused (diff or commit message),
now they should work everywhere.

Signed-off-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
---
Sending the patch the third time (haven't got any replies to previous two attempts).

 git-gui/git-gui.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index ba4e5c1..6618016 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -3710,6 +3710,8 @@ bind $ui_diff <$M1B-Key-v> {break}
 bind $ui_diff <$M1B-Key-V> {break}
 bind $ui_diff <$M1B-Key-a> {%W tag add sel 0.0 end;break}
 bind $ui_diff <$M1B-Key-A> {%W tag add sel 0.0 end;break}
+bind $ui_diff <$M1B-Key-j> {do_revert_selection;break}
+bind $ui_diff <$M1B-Key-J> {do_revert_selection;break}
 bind $ui_diff <Key-Up>     {catch {%W yview scroll -1 units};break}
 bind $ui_diff <Key-Down>   {catch {%W yview scroll  1 units};break}
 bind $ui_diff <Key-Left>   {catch {%W xview scroll -1 units};break}
@@ -3742,6 +3744,8 @@ bind .   <$M1B-Key-s> do_signoff
 bind .   <$M1B-Key-S> do_signoff
 bind .   <$M1B-Key-t> do_add_selection
 bind .   <$M1B-Key-T> do_add_selection
+bind .   <$M1B-Key-u> do_unstage_selection
+bind .   <$M1B-Key-U> do_unstage_selection
 bind .   <$M1B-Key-j> do_revert_selection
 bind .   <$M1B-Key-J> do_revert_selection
 bind .   <$M1B-Key-i> do_add_all
-- 
1.7.8.5

```

## Bert Wesarg, 2012-09-15 11:04

Subject: Re: [PATCH] git-gui: Fix semi-working shortcuts for unstage and revert
Message-ID: <CAKPyHN0_GVwCzrmH1YJu-cgGrPSQ3eqgFM8Ad1JJP8ZpF7Dx9w@mail.gmail.com>
URL: https://gitlist.dev/e/CAKPyHN0_GVwCzrmH1YJu-cgGrPSQ3eqgFM8Ad1JJP8ZpF7Dx9w%40mail.gmail.com
In-Reply-To: <1347665801-22634-1-git-send-email-vi0oss@gmail.com>

```
On Sat, Sep 15, 2012 at 1:36 AM,  <vi0oss@gmail.com> wrote:
> From: Vitaly _Vi Shukela <vi0oss@gmail.com>
>
> Make Ctrl+U for unstaging and Ctrl+J for reverting selection behave
> more like Ctrl+T for adding.
>
> They were working only when one area was focused (diff or commit message),
> now they should work everywhere.
>
> Signed-off-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
> ---
> Sending the patch the third time (haven't got any replies to previous two attempts).

For what its worth:

Acked-by: Bert Wesarg <bert.wesarg@googlemail.com>

But unless Pat reacts this is useless.

Bert

>
>  git-gui/git-gui.sh |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
> index ba4e5c1..6618016 100755
> --- a/git-gui/git-gui.sh
> +++ b/git-gui/git-gui.sh
> @@ -3710,6 +3710,8 @@ bind $ui_diff <$M1B-Key-v> {break}
>  bind $ui_diff <$M1B-Key-V> {break}
>  bind $ui_diff <$M1B-Key-a> {%W tag add sel 0.0 end;break}
>  bind $ui_diff <$M1B-Key-A> {%W tag add sel 0.0 end;break}
> +bind $ui_diff <$M1B-Key-j> {do_revert_selection;break}
> +bind $ui_diff <$M1B-Key-J> {do_revert_selection;break}
>  bind $ui_diff <Key-Up>     {catch {%W yview scroll -1 units};break}
>  bind $ui_diff <Key-Down>   {catch {%W yview scroll  1 units};break}
>  bind $ui_diff <Key-Left>   {catch {%W xview scroll -1 units};break}
> @@ -3742,6 +3744,8 @@ bind .   <$M1B-Key-s> do_signoff
>  bind .   <$M1B-Key-S> do_signoff
>  bind .   <$M1B-Key-t> do_add_selection
>  bind .   <$M1B-Key-T> do_add_selection
> +bind .   <$M1B-Key-u> do_unstage_selection
> +bind .   <$M1B-Key-U> do_unstage_selection
>  bind .   <$M1B-Key-j> do_revert_selection
>  bind .   <$M1B-Key-J> do_revert_selection
>  bind .   <$M1B-Key-i> do_add_all
> --
> 1.7.8.5
>

```

## Pat Thoyts, 2012-09-17 10:47

Subject: Re: [PATCH] git-gui: Fix semi-working shortcuts for unstage and revert
Message-ID: <87haqxj596.fsf@fox.patthoyts.tk>
URL: https://gitlist.dev/e/87haqxj596.fsf%40fox.patthoyts.tk
In-Reply-To: <1347665801-22634-1-git-send-email-vi0oss@gmail.com>

```
vi0oss@gmail.com writes:

>From: Vitaly _Vi Shukela <vi0oss@gmail.com>
>
>Make Ctrl+U for unstaging and Ctrl+J for reverting selection behave
>more like Ctrl+T for adding.
>
>They were working only when one area was focused (diff or commit message),
>now they should work everywhere.
>
>Signed-off-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
>---
>Sending the patch the third time (haven't got any replies to previous two attempts).
>
> git-gui/git-gui.sh |    4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
>diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
>index ba4e5c1..6618016 100755
>--- a/git-gui/git-gui.sh
>+++ b/git-gui/git-gui.sh
>@@ -3710,6 +3710,8 @@ bind $ui_diff <$M1B-Key-v> {break}
> bind $ui_diff <$M1B-Key-V> {break}
> bind $ui_diff <$M1B-Key-a> {%W tag add sel 0.0 end;break}
> bind $ui_diff <$M1B-Key-A> {%W tag add sel 0.0 end;break}
>+bind $ui_diff <$M1B-Key-j> {do_revert_selection;break}
>+bind $ui_diff <$M1B-Key-J> {do_revert_selection;break}
> bind $ui_diff <Key-Up>     {catch {%W yview scroll -1 units};break}
> bind $ui_diff <Key-Down>   {catch {%W yview scroll  1 units};break}
> bind $ui_diff <Key-Left>   {catch {%W xview scroll -1 units};break}
>@@ -3742,6 +3744,8 @@ bind .   <$M1B-Key-s> do_signoff
> bind .   <$M1B-Key-S> do_signoff
> bind .   <$M1B-Key-t> do_add_selection
> bind .   <$M1B-Key-T> do_add_selection
>+bind .   <$M1B-Key-u> do_unstage_selection
>+bind .   <$M1B-Key-U> do_unstage_selection
> bind .   <$M1B-Key-j> do_revert_selection
> bind .   <$M1B-Key-J> do_revert_selection
> bind .   <$M1B-Key-i> do_add_all

Looks good to me. Applied.

Thank you. 

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

```
