Skip to content

Fix file history for all sizes #1738

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

Merged

Conversation

cruessler
Copy link
Collaborator

This Pull Request is a follow-up to #1648 and related to #1560.

It changes the following:

  • It uses offset(), now exposed by ratatui, to keep items’ offset in sync with table_state’s offset.

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

@extrawurst
Copy link
Collaborator

thanks for tackling this.
I see a different behaviour now where the first view of file history does not show any entry selected and it only shows once you go up or down once

@cruessler
Copy link
Collaborator Author

thanks for tackling this. I see a different behaviour now where the first view of file history does not show any entry selected and it only shows once you go up or down once

I saw that, too. I assumed it was existing behaviour, but since it apparently is not, I’m going to fix it. :-) Thanks for the hint!

@cruessler cruessler force-pushed the file-history-issue-1560-follow-up branch from f54cbe9 to 55cd4c7 Compare July 2, 2023 10:44
@cruessler
Copy link
Collaborator Author

The issue turned out to be more complex than I initially thought. I overhauled how selection as well as data fetching and refetching work in FileRevlogComponent. So far, I’ve found no issues. Behavior I tested:

  • Opening the history for a file, scrolling up and down, opening commits and returning to the history view
  • Closing the history for one file, opening it for another one, then repeating the tests done for the first file

@extrawurst
Copy link
Collaborator

there seems something off:
Screenflick Movie 10

@extrawurst
Copy link
Collaborator

extrawurst commented Jul 29, 2023

@cruessler any updates? putting this in draft in the meantime

@extrawurst extrawurst marked this pull request as draft July 29, 2023 21:11
@cruessler
Copy link
Collaborator Author

I haven’t gotten to look at the PR again yet. If I don’t get to it this week, then I’ll find time end of next week, I think.

@cruessler cruessler force-pushed the file-history-issue-1560-follow-up branch from 55cd4c7 to 87007c9 Compare August 10, 2023 14:20
@cruessler
Copy link
Collaborator Author

@extrawurst I think I found the issue. I rebased and manually tested the branch again, including the test case you provided.

@cruessler cruessler marked this pull request as ready for review August 10, 2023 14:35
@extrawurst
Copy link
Collaborator

now the scrolling works but the diffs still do not update:

Screenflick.Movie.3.mp4

@cruessler
Copy link
Collaborator Author

Thanks a lot for checking so thoroughly, that’s very much appreciated! I pushed another fix.

@extrawurst
Copy link
Collaborator

extrawurst commented Aug 11, 2023

Visually it works now!

I am not sure if this implementation is working as intended though. I added a log::info in fetch_commits (line 221):

log::info!("revlog: fetch commits: {offset}");

if I reduce the batch size to force it to have to fetch commits (200 batch size) this shows that every arrow down leads to a new fetch_commits as soon as the batchsize-elements in view (or something else ^^) is reached:

(1) gitui::app: [src/app.rs:392] event: Input(Key(KeyEvent { code: Down, modifiers: NONE, kind: Press, state: NONE }))
revlog: fetch commits: 174
...
(1) gitui::app: [src/app.rs:392] event: Input(Key(KeyEvent { code: Down, modifiers: NONE, kind: Press, state: NONE }))
revlog: fetch commits: 175
...

this is not as efficient as it could be if we would fetch commit infos in batches and then only again once we run out.

side note: the selection should go up and down inside the view before the scroll position changes to keep the selection in view. right now if you scroll down it will stick to the bottom and the scroll position changes when scrolling up (although I am ok if this is done in a followup PR)

please also rebase on master particularly 9eb8d47 will affect this branch and make reading the log way easier :)

@extrawurst
Copy link
Collaborator

extrawurst commented Aug 11, 2023

ok comparing with current master we should fix the scrolling up/down issue because on master it does it correctly with the scrolling window moving only when the selection reaches the upper/bottom border

putting it in draft again in the meantime, please ping me once you had time to look into it again 👍

@extrawurst extrawurst marked this pull request as draft August 12, 2023 16:51
- Replace temporary fix by proper fix
- Re-organize code related to setting selection and fetching data to
  make sure `self.items` is updated whenever necessary
@cruessler cruessler force-pushed the file-history-issue-1560-follow-up branch from a0a19c2 to cf1be61 Compare September 8, 2023 18:05
@cruessler
Copy link
Collaborator Author

I updated the PR, tested it quite a bit, hoping not to have missed anything, and ran make check. That took slightly longer than expected, so I’ll take a walk now. :-)

@extrawurst extrawurst marked this pull request as ready for review September 9, 2023 09:27
@extrawurst extrawurst merged commit aa7aa7a into gitui-org:master Sep 9, 2023
@cruessler cruessler deleted the file-history-issue-1560-follow-up branch September 11, 2023 08:53
IndianBoy42 pushed a commit to IndianBoy42/gitui that referenced this pull request Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants