diff options
author | delthas <delthas@dille.cc> | 2022-06-04 09:20:49 +0200 |
---|---|---|
committer | delthas <delthas@dille.cc> | 2022-06-04 09:23:01 +0200 |
commit | 1c5d7309436071c4787395f80ed93f6182a0863b (patch) | |
tree | 6f776f4ddba84f7998fe6d52944700878e038de8 /ui | |
parent | /mode: enable getting the channel modes without parameters (diff) |
Fix crashing on removing last char of backsearch pattern
To reproduce:
- Enter a message
- Enter a substring of that message, backsearch it
- Press backspace until the substring is cleared
- senpai crashes
This merely fixes the crash. We could do backsearch better in the future
but that's a whole feature overhaul to be done in its own patch.
Thanks to paren@disroot.org for helping me find the issue by sending a
panic trace :)
Diffstat (limited to 'ui')
-rw-r--r-- | ui/editor.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/editor.go b/ui/editor.go index 606bf8d..4892382 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -122,7 +122,7 @@ func (e *Editor) RemRune() (ok bool) { e.left() e.autoCache = nil if e.backsearch { - if e.TextLen() == 0 { + if e.TextLen() == 0 || len(e.backsearchPattern) == 0 { e.backsearchEnd() } else { e.backsearchPattern = e.backsearchPattern[:len(e.backsearchPattern)-1] |