summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-06-04 09:20:49 +0200
committerdelthas <delthas@dille.cc>2022-06-04 09:23:01 +0200
commit1c5d7309436071c4787395f80ed93f6182a0863b (patch)
tree6f776f4ddba84f7998fe6d52944700878e038de8
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 :)
-rw-r--r--ui/editor.go2
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]