Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

diff window draws behind menu if diff is too large #1

Open
weilbith opened this issue Sep 28, 2021 · 5 comments
Open

diff window draws behind menu if diff is too large #1

weilbith opened this issue Sep 28, 2021 · 5 comments

Comments

@weilbith
Copy link
Owner

weilbith commented Sep 28, 2021

Self report 😬
So if someone stumbles over it, this is already known. I'm open for suggestions whats the best solution for this issue.
It is possible to calculate the maximum height for the diff window. The question is then what to do with the content. A simple solution would be to limit the height to this maximum and then add mappings to the menu to scroll the preview. What I don't like about it, is that the user can't easily see that the diff is bigger or not.
It would be also nice to have the diff summary (means the files affected with how many changes) to be always present, no matter how large the diff is. The question would be how to arrange this... Folds? Extra window for diff summary and preview? ...

@IndianBoy42
Copy link

I think using a separate virtual window for the diff makes sense. Then neovim could handle overlapping, limiting size and even could make it scrollable and all those virtual window GUI features. There is no need to reimplement GUI elements that are builtin.

If all three 'subwindows' were their own virtual windows, then neovim could also handle the borders (including user customizability) for you

@weilbith
Copy link
Owner Author

weilbith commented Oct 8, 2021

I'm a little confused. These are actual three different windows. Did you misinterpreted that or do I simply not understand what you mean? 😂

@IndianBoy42
Copy link

Ah no I misunderstood your post, because you said 'Extra window for diff summary and preview'. I think then just cropping it is okay? How often do you have code actions with diffs more than half a page anyway.

Also side-by-side diffs would be more height efficient, and word diffs would be the most compact. So those would be interesting to look at

@weilbith
Copy link
Owner Author

weilbith commented Oct 8, 2021

Ah no I misunderstood your post, because you said 'Extra window for diff summary and preview'.

😂 Just to make it 100% sure and void any kind of misunderstandig: there are three different windows open per default: the menu-, the details- and the diff-window. All of them are "actual" windows with their own buffer, border etc. pp

I think then just cropping it is okay? How often do you have code actions with diffs more than half a page anyway.

Yes. And then have mappings on the menu window to scroll the diff window? 🤔

Also side-by-side diffs would be more height efficient, and word diffs would be the most compact. So those would be interesting to look at

Hmm. Though the squares plane size remains the same, I don't think this works well on most displays.
But maybe I get you wrong. Could you maybe artificially construct an image where you show it would look like for an example please? 😃

@JSchrtke
Copy link

Yes. And then have mappings on the menu window to scroll the diff window? 🤔

Just chiming in, I think it would be good to have a configurable mapping for this. For example, nvim-cmp allows you to do exactly this.

      ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
      ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),

Very useful, I use it all the time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants