zellij icon indicating copy to clipboard operation
zellij copied to clipboard

fzf preview scrolling doesn't work

Open jscarrott opened this issue 2 years ago • 11 comments

h.

Basic information

zellij --version: 30 stty size: 53 232 uname -av or ver(Windows): Linux john-work 5.15.0-40-generic #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux terminal: alacritty

Further information Outside fzf you can use the mouse wheel to scroll a fzf preview window but inside a zellij session this doesn't work In zellij (not very exciting): https://asciinema.org/a/yJFpRqp0N6YdcPBzr0cOtM1zR

Outside zellij: https://asciinema.org/a/uW4iYnj98QVLJojt6iCF2t5LK

jscarrott avatar Jul 26 '22 09:07 jscarrott

@tlinford - do we already send the scroll events to panes with mouse-mode on?

imsnif avatar Jul 26 '22 09:07 imsnif

@imsnif, nope, not yet - that part of the code seems to have lagged behind a bit. Right now it's just hard coded to scroll the active pane up/down instead of checking if mouse_mode is on: https://github.com/zellij-org/zellij/blob/main/zellij-server/src/screen.rs#L1125-L1128

Can look into this soon, or it could be a nice candidate for good first issue maybe, what do you say?

tlinford avatar Jul 26 '22 14:07 tlinford

@tlinford - IMO it would be best to implement this ASAP (when you have time ofc)

imsnif avatar Jul 26 '22 14:07 imsnif

@imsnif my bad, was away and missed that forwarding scroll events is implemented! did a quick run with fzf and it works alright for me, not sure why it's not working on your end @jscarrott, is other mouse related functionality working properly for you (changing focused pane/active tab, etc)?

tlinford avatar Jul 30 '22 20:07 tlinford

I can focus panes, click on the tab icons at the top to switch tabs, resize the floating window. On closer inspection, this seems to be a bat issue. Scrolling works in bat outside of zellij but is broken inside zellij. I tried rxvt as well as alacritty and got the same behaviour. As the pager bat is using is less, this might be something to do with less actually.

jscarrott avatar Aug 01 '22 09:08 jscarrott

@tlinford Okay I have some more information, it is an issue with less specifically. For some reason using zellij requires passing --mouse to less to have mouse scrolling but outside zellij it doesn't. I can't think why this would make any difference although if I can find time I'll see if I can dig any further.

jscarrott avatar Aug 01 '22 10:08 jscarrott

Exporting LESS="--mouse" fixes less in zellij, fixes bat in zellij but still no scrolling in fzf. I've also just notices that I can't scroll through the files in fzf either.

jscarrott avatar Aug 01 '22 11:08 jscarrott

Okay, I think I understand what's happening. It looks like a lot of terminal emulators implement faux scrolling, where for applications in alternate mode, scroll events get turned into up/down arrow key events.

@imsnif do you think we should implement this?

tlinford avatar Aug 02 '22 08:08 tlinford

Okay, I think I understand what's happening. It looks like a lot of terminal emulators implement faux scrolling, where for applications in alternate mode, scroll events get turned into up/down arrow key events.

@imsnif do you think we should implement this?

Interesting find, I remember you mentioning this in the past. What would be the downsides or tradeoffs of us implementing this?

imsnif avatar Aug 02 '22 10:08 imsnif

Interesting find, I remember you mentioning this in the past. What would be the downsides or tradeoffs of us implementing this?

I can't really see any downsides to this.

tlinford avatar Aug 02 '22 11:08 tlinford

Cool, so let's go for it.

imsnif avatar Aug 02 '22 12:08 imsnif