-
Notifications
You must be signed in to change notification settings - Fork 329
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
Issue with scrolling using alt key #1773
Comments
Actually, What happens is that when you press and hold alt+j, the key events are sent to I suggest you report the issue to |
BTW I wrote a very quick and dirty test program to print key events as they are pressed, might be helpful in debugging: package main
import (
"fmt"
"github.com/gdamore/tcell/v2"
"log"
)
func emit(screen tcell.Screen, x, y int, str string) {
for i, c := range str {
screen.SetContent(x+i, y, c, nil, tcell.StyleDefault)
}
}
func draw(screen tcell.Screen, key *tcell.EventKey, counter int) {
screen.Clear()
emit(screen, 0, 0, fmt.Sprintf("key: %#v", key))
emit(screen, 0, 1, fmt.Sprintf("counter: %v", counter))
screen.Show()
}
func main() {
screen, err := tcell.NewScreen()
if err != nil {
log.Fatalf("failed to create screen %v", err)
}
if err := screen.Init(); err != nil {
log.Fatalf("failed to initialize screen %v", err)
}
defer screen.Fini()
counter := 0
for {
ev := screen.PollEvent()
switch ev := ev.(type) {
case *tcell.EventKey:
if ev.Key() == tcell.KeyEscape {
return
}
counter++
draw(screen, ev, counter)
}
}
} |
Thanks a lot for your response, I did open an issue in the tcell library github page, here is the link : And regarding the test program you provided would you please confirm that the link used in the tcell library import is still valid? It seems to be outdated when I try out the program (correct me if I am missing something). |
Importing
|
Apologies, indeed I didn't use these steps. Thanks for providing them and mentioning the tutorial. |
Closing as the root cause is not from |
Hello, first of all I would like to thank all the maintainers and contributors for this amazing tool, I use it daily and find it really useful so thanks a lot!
Now regarding my issue, I have my lfrc to only contain the following four lines (the two latter remapings are because some terminals interpret alt+k/j as ë/ê respectively) :
Now when I press alt+j/k to scroll down/up it works perfectly, however the problem appears when alt key is released while j/k are still being pressed. When that happens the cursor scrolls in the background but lf doesn't update the display and the cursor appears to be standing still at its place, and only then when I either stop holding j/k or press alt once again while j/k are still being hold, only then lf instantly updates the display and displays the new cursor position. This issue seems to be present in some terminals only while the others work fine. For an instance, the issue is present in gnome-terminal and lxterminal while in xterm it works fine. This issue seems to happen with the alt key only, if we replace the alt+j/k remaps with ctrl+j/k everything works fine in all terminals.
Tested on the latest stable release as of the time of writing this issue (which is r32)
The following is an illustration of what I mean. The keys which are being pressed are displayed at the bottom.
This is for xterm which doesn't contain the issue:
This is for terminator which has the issue:
If there are further information needed that I didn't provide please let me know.
Thanks a lot in advance for your time and help!
The text was updated successfully, but these errors were encountered: