Skip to content
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

[BUG] lf receiving wrong input #1186

Closed
Joyje opened this issue Apr 1, 2023 · 8 comments
Closed

[BUG] lf receiving wrong input #1186

Joyje opened this issue Apr 1, 2023 · 8 comments

Comments

@Joyje
Copy link

Joyje commented Apr 1, 2023

map <c-i> ...
gives this error message when used in lf:
unknown mapping: <tab>
Since <c-i> != <tab> this is obviously a bug.

Please test to confirm its not only on my setup

@ilyagr
Copy link
Collaborator

ilyagr commented Apr 1, 2023

I think it's a fundamental limitation of linux's usual terminal protocol that terminal programs can't distinguish <c-i> from <tab>. Same for <c-j> and <enter>. Some terminals try to work around that by extending the protocol, but that won't work everywhere and I doubt the library we use (tcell) supports it.

So, this bug might be a little more pervasive than you thought. We can't do anything about it.

@Joyje
Copy link
Author

Joyje commented Apr 1, 2023

I think it's a fundamental limitation of linux's usual terminal protocol that terminal programs can't distinguish <c-i> from <tab>. Same for <c-j> and <enter>. Some terminals try to work around that by extending the protocol, but that won't work everywhere and I doubt the library we use (tcell) supports it.

So, this bug might be a little more pervasive than you thought. We can't do anything about it.

If that is accurate, then why can other programs, such as vim for example, differentiate between those inputs without any issues whatsoever, in the same terminal even?

@ilyagr
Copy link
Collaborator

ilyagr commented Apr 1, 2023

One reason it might work for you is if you use a program and a terminal that support Kitty's extension protocol. Your terminal and program should then be listed here. Note that there are only a few of them, but they do include recent versions of Vim. In principle, if you got tcell to support that protocol, it would immediately work for lf on those terminals.

Update: According to gdamore/tcell#500 (comment), the author of tcell is at least considering it.

I also don't know what happens on Windows.

If neither of these is the case, I have no idea how you got it to work. It certainly doesn't work with Vim on my terminal (alacritty).

@ilyagr
Copy link
Collaborator

ilyagr commented Apr 1, 2023

Apparently, there's an older alternative protocol: https://vimhelp.org/map.txt.html#modifyOtherKeys. It's supported by Micro's fork of tcell: https://github.com/zyedidia/tcell/.

So, you could probably hack together a version of lf that supports it by combining the two. I wouldn't move the official version of lf to use https://github.com/zyedidia/tcell/, though, as it's only being supported for the use of the Micro project.

Thanks for having me learn something new!

@Joyje
Copy link
Author

Joyje commented Apr 1, 2023

Huh... that's interesting. I use rxvt and as far as I can see it isn't listed there so it shouldn't be compatible for me either. However, as I understand it with vim, it seems like it is implemented directly into the program so it shouldn't matter what terminal you're using, meaning it should work for you as well when using vim. That makes is kind of strange that it doesn't work for you. Maybe your version of vim is old?

Anyhow it goes to show then that this is at least fixable, no matter what terminal is used. However I understand it might be a huge project to migrate from tcells protocol to kittys protocol, and pointless even since tcell might add support for it in the future anyways as you mentioned.

Still, it is frustrating as hell.

@Joyje
Copy link
Author

Joyje commented Apr 1, 2023

Thanks for having me learn something new!

The same to you! Much appreciated!

Let's hope it gets fixed by the guys building tcell.

@joelim-work
Copy link
Collaborator

This is a general issue with terminals, not an issue with lf. I have added a section in the Troubleshooting page of the wiki about this.

@Joyje
Copy link
Author

Joyje commented Apr 12, 2024

This is a general issue with terminals, not an issue with lf. I have added a section in the Troubleshooting page of the wiki about this.

Sort of, but not really. This is an issue with 'tcell', not with terminals. These key combinations still work in terminal emulators that doesn't support kitty, but only inside certain programs. How or why I do not know exactly, but if it works in 'vim' it is also possible to make it work in 'lf' somehow, if this is something we would want to pursue.

I would assume the issue is probably related to the protocols only, no matter what terminal emulator you are using, and some terminal programs such as 'vim' might use their own written protocols independenty from the terminal emulator itself. This is just an assumption however.

Also, I think the best way to handle this is to let the people developing 'tcell' fix it.

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

No branches or pull requests

3 participants