nvim-code-action-menu icon indicating copy to clipboard operation
nvim-code-action-menu copied to clipboard

diff window draws behind menu if diff is too large

Open weilbith opened this issue 3 years ago • 5 comments

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? ...

weilbith avatar Sep 28 '21 08:09 weilbith

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

IndianBoy42 avatar Oct 08 '21 02:10 IndianBoy42

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

weilbith avatar Oct 08 '21 06:10 weilbith

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

IndianBoy42 avatar Oct 08 '21 08:10 IndianBoy42

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? 😃

weilbith avatar Oct 08 '21 09:10 weilbith

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.

JSchrtke avatar Dec 30 '21 22:12 JSchrtke