gitui icon indicating copy to clipboard operation
gitui copied to clipboard

When moving to source view full screen please allow left arrow to go back

Open Kamilcuk opened this issue 1 year ago • 10 comments

Is your feature request related to a problem? Please describe. In "Status [1]" tab, you can navigate right to the source code with right arrow. But then you have to hit escape to navigate back left.

Describe the solution you'd like Please make left arrow navigate left.

Describe alternatives you've considered Escape.

Additional context image

now I click "right arrow"

image

Now I can't go back left with left arrow. Only with Escape I can go back.

Thank you for gitui it is amazing.

Kamilcuk avatar Jun 21 '23 15:06 Kamilcuk

I believe that worked prior to v0.23.0.

raphCode avatar Jul 05 '23 14:07 raphCode

I recently updated to v0.23 and this feels very frustrating to me. I'll try to take up this issue later today and temporarily roll back to v0.22.x on my machine until a new release is made.

holly-hacker avatar Jul 11 '23 08:07 holly-hacker

I am also not a fan of the current solution but the big UX fail that comes with allowing arrow-left is visualised here:

https://github.com/extrawurst/gitui/assets/776816/caac6503-29bc-4917-972b-fdbc5c9dd007

hope someone has an idea how to solve this.

one idea (also not great) is to open the full-screen diff with a separate key press and not via arrow-right and then one has to naturally escape that fullscreen view via esc and can freely scroll left/right by holding down the arrow keys

extrawurst avatar Aug 14 '23 17:08 extrawurst

To me, restoring the old functionality but allowing a full-screen diff with a dedicated keybind sounds like a good solution. I've been using the v0.23 release lately but I still find the old behavior of resizing the diff view more ergonomic.

Another solution would be to allow word-wrapping which removes the need for scrolling altogether. Wrapped lines could be shown by putting a ↩ (U+21A9) at the end of the wrapped lines. I don't think this needs to be mutually exclusive with the other option though.

holly-hacker avatar Aug 15 '23 11:08 holly-hacker

Word-wrapping seems to be a good solution. Another possible approach - scroll the diff viewer only with vim-like hjkl and use arrows only for pane navigation.

ShrykeWindgrace avatar Aug 22 '23 10:08 ShrykeWindgrace

I'm not a big fan of hjkl because it assume a qwerty-like keyboard layout and it's not very intuitive. However, I'll take it over the current behavior which I find more confusing.

Perhaps we can only allow key-repeat when scrolling and require a new keypress to exit out of the view.

holly-hacker avatar Aug 22 '23 11:08 holly-hacker

Perhaps we can only allow key-repeat when scrolling and require a new keypress to exit out of the view.

unfortunately terminals do not allow that distinction

extrawurst avatar Aug 22 '23 11:08 extrawurst

I want to discuss the initial question about this issue. I meet the same problem like the beginning. But i found that if i open the same view of Log[2] > Files: > Diff, i can use q to exit the preview of difference. So maybe we can use the same way for the Status > Unstaged Changes > Diff to exit the preview with q.

gxt-kt avatar Oct 08 '23 02:10 gxt-kt

It seems like #1955 is relevant here — the distinction between diff-as-pane (in the status view) and fullscreen diff seems important for usability.

In my opinion a good usability guideline for arrow key navigation is: If you can ENTER a mode with right arrow, you should be able to EXIT it with left arrow.

It seems like there are a few ways to fix this:

  1. Restore pre-0.23 behavior. Add a keybinding to "zoom" into fullscreen diff, where left/right-arrows scroll and Esc exits back to status view.

  2. Restore pre-0.23 behavior. Add new keybindings for horizontal scrolling. (Maybe < and > by default? They're near the arrow keys in a lot of layouts.)

  3. (This is kinda wild but hear me out.) Keep the current behavior, but add a guard time after which left-arrow will exit the fullscreen diff. Could be a good proxy for whether the user is just holding down the left arrow to scroll or not. Idk, just a thought.

Pseudocode for option 3:
put 666ms into guardTime
on leftArrow
    if can scroll left
        put current time into lastLeftArrowTime
        scroll left
    else
        if current time > lastLeftArrowTime + guardTime
            exit diff view
        else
            do nothing
        end if
    end if
end leftArrow

smammy avatar Nov 23 '23 17:11 smammy