fyne-io / terminal

A graphical terminal emulator for Linux using Fyne
Other
247 stars 37 forks source link

Fix issue when a key name could be unknown #90

Open andydotxyz opened 2 months ago

andydotxyz commented 2 months ago

Fixes #89

xaionaro commented 1 month ago

Before

xaionaro@void:~$ fyneterm

Switch the layout to Russian and press CTRL + '=':

panic: runtime error: index out of range [0] with length 0

goroutine 12 [running]:
github.com/fyne-io/terminal.(*Terminal).TypedShortcut(0xc00027e400, {0xd98a60?, 0xc0066d0eb8?})
    /home/xaionaro/.gvm/pkgsets/go1.22.1/global/pkg/mod/github.com/fyne-io/terminal@v0.0.0-20240716015208-3f73425d4e0f/input.go:170 +0x23b
fyne.io/fyne/v2/internal/driver/glfw.(*window).triggersShortcut.func1()
    /home/xaionaro/.gvm/pkgsets/go1.22.1/global/pkg/mod/fyne.io/fyne/v2@v2.5.1-0.20240716011200-bed23d914f5d/internal/driver/glfw/window.go:912 +0x24
fyne.io/fyne/v2/internal/driver/common.(*Window).RunEventQueue(...)
    /home/xaionaro/.gvm/pkgsets/go1.22.1/global/pkg/mod/fyne.io/fyne/v2@v2.5.1-0.20240716011200-bed23d914f5d/internal/driver/common/window.go:35
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1 in goroutine 1
    /home/xaionaro/.gvm/pkgsets/go1.22.1/global/pkg/mod/fyne.io/fyne/v2@v2.5.1-0.20240716011200-bed23d914f5d/internal/driver/glfw/window.go:997 +0x136

After

xaionaro@void:~$ go install github.com/fyne-io/terminal/cmd/fyneterm@6d9024789cffec0be7ca224cfaab4f6a773f3388
go: downloading github.com/fyne-io/terminal v0.0.0-20240711112249-6d9024789cff
xaionaro@void:~$ fyneterm

Switch the layout to Russian and press CTRL + '=': nothing happens.

andydotxyz commented 1 month ago

Switch the layout to Russian and press CTRL + '=': nothing happens.

What should Ctrl+= perform?

xaionaro commented 1 month ago

Switch the layout to Russian and press CTRL + '=': nothing happens.

What should Ctrl+= perform?

Well, I hoped to increase font size. But here I'm just saying that the bugfix helped and now it no longer panics (thus "nothing happens") :)

andydotxyz commented 1 month ago

Increasing font size is Ctrl+"+" (ctrl + shift + "=" on my keyboard)