Piturnah/gex

[Feature]: It should scroll to fit the whole file diff when you expand it

Closed this issue · 1 comments

Type of Feature

New Feature

Description

Ok, with the current scrolling implementation (f20b535) there is a serious problem which is that you can never get back to the top of the buffer. This is often necessary to do because it has the name of the current branch and the most recent commit and etc.

Additional Information

I tried to implement it in 117cb8e such that if there was ever a case where the entire selected item would fit if you just rendered from the beginning of the buffer then you should do that. It worked pretty well but I have to revert it after 31570ea because this introduced the following edge case:

  1. You are on some item that fits, so it's rendering from the top
  2. You move down to a fully expanded file that doesn't fit, so it renders from the top of that file
  3. You cursor down to the first hunk of that file, which does fit, so it renders from the top again

This is obviously really awful UX as you just pressed down twice and yet the scrolling is bouncing up and down both ways. I tried adding a field that held state of the previous selection but there were other worse edge cases introduced.

Ok, fuck it -- I am gonna revert 31570ea instead. Not happy with this but I think it's the better option.