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
Support Ctrl+[backspace/delete] to delete the word to the left or right of the cursor #4662
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. A much better implementation than what I had. However, I managed to get it to crash in two ways.
- Write a single space into the entry and move the cursor to the left.
- Clicking CTRL + BACKSPACE or CTRL + DELETE will now crash.
panic: runtime error: makeslice: len out of range
goroutine 66 [running]:
fyne.io/fyne/v2/widget.(*RichText).deleteFromTo(0xc00292d800, 0x14, 0x13)
/var/home/jacob/git/fyne/widget/richtext.go:184 +0x2cf
fyne.io/fyne/v2/widget.(*Entry).deleteWord(0xc003ceb400, 0x1)
/var/home/jacob/git/fyne/widget/entry.go:907 +0xe5
fyne.io/fyne/v2/widget.(*Entry).registerShortcut.func12({0xc003ceb450, 0xbe0d60})
/var/home/jacob/git/fyne/widget/entry.go:1214 +0x1c
fyne.io/fyne/v2.(*ShortcutHandler).TypedShortcut(0xc003ceb450, {0xe4c340, 0xc0035ae060})
/var/home/jacob/git/fyne/shortcut.go:21 +0x6e
fyne.io/fyne/v2/widget.(*Entry).TypedShortcut(0xc00010e360?, {0xe4c340?, 0xc0035ae060?})
/var/home/jacob/git/fyne/widget/entry.go:963 +0x25
fyne.io/fyne/v2/internal/driver/glfw.(*window).triggersShortcut.func1()
/var/home/jacob/git/fyne/internal/driver/glfw/window.go:907 +0x24
fyne.io/fyne/v2/internal/driver/common.(*Window).RunEventQueue(0x0?)
/var/home/jacob/git/fyne/internal/driver/common/window.go:35 +0x38
created by fyne.io/fyne/v2/internal/driver/glfw.(*gLDriver).createWindow.func1 in goroutine 1
/var/home/jacob/git/fyne/internal/driver/glfw/window.go:961 +0x145
Hmm, I'm getting a different crash:
will try to dig deeper when I have some time |
@dweymouth Did you manage to have another look at it? :) |
No I have not. If you happen to find the problem feel free to add a code suggestion :) |
Adds Ctrl+Backspace and Ctrl+Delete shortcuts to Entry for deleting the word to the left and right of the cursor, respectively. On Mac OS, the modifier is option (aka alt) instead.
Fixes #4524
Checklist: