-
Notifications
You must be signed in to change notification settings - Fork 612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrolling broken with diff-in-log view #155
Comments
I agree that the log view is weird and could use some love. Basically, it acts similar to the main view, and most other views in tig, where the "sub-view" (in this case diff) only gets partial focus when opened in that certain requests (enter, move to next, move to previous) are forwarded to the parent view (in this case the log view). This works well in the main and blame views where 'move to next' translates to move the cursor to the next commit or line. Fixing this for the log view should be fairly simple. In the meantime, the workaround is to bind up/down to move-up/move-down instead of next/preview (which is the default). bind diff Up move-up |
Is this too much of a hack? It modifies the behaviour, but at least makes things work in an expected manner. Thanks.
|
I think it would be cleaner to just add a |
I don't understand. In Sorry for the ramble; I'll patch it if I understand how best to fix this. |
I think it was I who was rambling. The best approach I see is to introduce a new view_flag (for example named VIEW_NO_PARENT_NAV) which will be added to the log view. The view flag will be used in view_driver() to ensure that the diff view receives the move request (from the Up and Down key) Here's the current code:
Which should check the flag before forwarding the move request to the parent view, like this:
An extra bonus would be to detach log_request() from pager_request() by having it handle REQ_ENTER itself, since I don't think it makes sense (to me anymore) to scroll down the view when pressing enter on a commit line. I don't use the log view, so I would like to know your opinion. |
Hi Jonas. Thanks for your hint. Your suggestion was almost right, but it should be As for handling log_request, I frankly don't like scrolling when enter is pressed. For my Now, what would be ideal, is if I press enter even on the commit message, it should open up the commit I have focused. The trouble is that we only know the last touched commit. So, if I scroll down from the first commit to the second commit's "commit" line, then immediately scroll back up, then what is displayed on the status bar is the second commit. This would require additional effort, and I might take this up as a secondary task. What do you think? Thanks! |
I agree with you that the log view should not scroll when pressing Enter on a commit. I think it make sense to make the log view more context sensitive. Example code for how to do this can be found in diff_get_pathname().
Basically, To handle the back-scroll issue, you could add some logic inside log_request() to pre-process certain move requests based on the view state. For example, if the current line has type LINE_COMMIT, REQ_MOVE_UP/REQ_PREVIOUS should recalculate the 'touched commit', etc. To communicate that the 'touched commit' must be recalculated the log could clear one the view->ref string so that log_select (which needs to be added) knows it must find the commit based on the current line. Home this makes sense. |
Thanks Jonas. This makes total sense. I'll take a stab at it over the next few days, and seek your comments. |
I've managed to hack together what you've suggested. It works perfectly for me, but I haven't sent in the patches because I wanted your inputs on style. The commits are here: kumanna@4e699c0 Now, in 4e699c0, can I improve this:
Or is this an acceptable way of copying the commit hash? Second, I set If you are happy with the patches, please let me know and I will git send-email them to you. Thanks. |
Ah, so it also needs work when page up/down is used. Let me handle that as well. EDIT: Done in 387c693 |
Ah, you just pushed to master. I will need to rebase back to master, so once you review the above commits, I shall do so and git send-email them. Thanks. |
Also, while you're at it, I personally feel that adding the above patch now leads me to question 888611d. This is because the behaviour in the standard tig view is that the arrows move across the commits, while pressing enter scrolls the commit. This is the behaviour in Mutt as well. I can adjust my usage behaviour either way, so it doesn't matter, but just pointing this out. Thanks. |
I've updated and rebased to master here. This is the same as the patch series sent to the git list. https://github.com/kumanna/tig/tree/log-refactor |
Reviewed. I really like these improvements. |
I am getting lost in your posts to git@vger and your github repository. Can you please make a new pull request? |
Sorry. I will be consistent and use only Github henceforth. A pull request will come your way. Thanks. |
No problem. BTW, I've added the method I talked about, maybe it will simplify your patch. It's called |
Ah. Give me a minute, I'll see what you've done. |
Yeah, sorry about that, I am a bit disorganized: asking one thing and sending additional info at the same time. ;) |
Okay. I'll resend a pull request. |
In the log view, when scrolling across a commit, the diff view should automatically switch to the commit whose context the cursor is on in the log view. This commit changes things to catch the REQ_ENTER in the log view and handle recalculation of the commit and diff display from log_request, rather than delegating it to pager_request. In addition, it also gets rid of unexpected upward scrolling of the log view. Fixes GH #155 Signed-Off-By: Kumar Appaiah <[email protected]>
Forgot to close this from the commit. Anyways, thanks for your work on this @kumanna . |
Hi.
If I use the log view, scroll down, and then open a diff by focusing on it and press enter to view it, I expect the arrow keys to move along the log view. The up-arrow does move the parent view, but in a weird way when I want it to go up (i.e. both the highlight line and the view are scrolled up). In other words, when the diff is displayed, an UP arrows causes both the view AND the highlighting line to scroll up simultaneously, while scrolling down keeps the highlight line intact while only scrolling the view.
Please let me know if I need to describe the issue better. I couldn't patch it myself, since much has changed in the way the views are handled since this change was introduced in 5568f99.
The text was updated successfully, but these errors were encountered: