gitui
gitui copied to clipboard
Allow to scroll diffs horizontally
Sometimes there are diffs that a longer then console allows. It would be nice to have some kind of horizontal scroll to view whole diff.

First idea how to make it - allow scroll horizontally when right arrow button pressed in diff view. When left arrow pressed - reset horizontal scroll and change focus to changed/staged. It could be not really ergonomic in some cases since diff view resets.
Second idea - allow to reorder panels and make staged and unstaged stand side-by-side on top part and diff on the most of the bottom part of the console. The bad in this case - we need either divide vertical scrolling with buttons other then up/down arrow or make complicated jump keys to change focus back to file panels.
I am torn here. On one side I would like to postpone this until we have diff rendering rewritten to be able to use delta first (see #358) which should also give us line wrapping. on the other hand I can see a separate feature request here where we open up a diff in a fullscreen popup where we can scroll all directions freely🤔 If we do the latter it would be decoupled from the first.
Most editors usually configure word wrap, so might be a good idea to make it customizable as well. Like other git clients just use their own config section in .gitconfig (Source Tree, delta, and probably sublime merge, but not sure, ).
Also, when line wrap will be introduced not everyone will be happy with such change. Some files, like CSV, is good with word diffs but without line wrap.
I like the idea of separate popup. Also potential for conflict solver view.
Also, when line wrap will be introduced not everyone will be happy with such change
for sure this will be something to configure 👍
@extrawurst Do you already know which direction you want to go? I just had a look at tig to see what it does, and it supports horizontal scrolling in diff views, among others. Would that be an option here? It would at least be reasonably simple to implement I hope.
yeah I was thinking about testing out horizontal scrolling while focusing on the diff. once we reach back to the left side another left command will select the index/wd side again
For me personally, this is a very high priority issue since I have very little screen space(due to my UI scaling requirements) and even 100line-long code gets cut off.
So if there's any way to speed this up or pointers as for how I can implement it in a way that would be accepted in a PR, that'd be great 🙂
I would accept a PR for sure. A POC that just uses the right-arrow to scroll as soon as the diff is selected and then left-arrow as long as we are not at the left border 👍
PR #1250 seems unmaintained, anyone up for grabs?
PR #1250 seems unmaintained, anyone up for grabs?
If it’s still unmaintained next week, I’d like to take a look (I’ll have a few weeks of vacation, and I’ll probably want to code a bit during that time). If anyone else wants to give it a try, go ahead!
@cruessler seems like you can take it away :)
@cruessler is going to provide this nice QoL feature for 0.23 - the PR is almost ready to merge 🚀