summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordelthas <delthas@dille.cc>2022-07-20 00:57:44 +0200
committerdelthas <delthas@dille.cc>2022-07-20 00:58:32 +0200
commitb3f64aeefb0a3d43667ef7392bc1aeb1fdfa5f17 (patch)
tree8075fb62818052b4f847c2c4140672f9972d1708
parentUpdate soju.im/read to draft/read-marker (diff)
Fix dropping words in /msg, /query, /part
Inspired by a patch from gildarts <gildarts@orbital.rocks>
-rw-r--r--commands.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/commands.go b/commands.go
index 072c433..9113485 100644
--- a/commands.go
+++ b/commands.go
@@ -636,9 +636,6 @@ func fieldsN(s string, n int) []string {
if n == 1 {
return []string{s}
}
- if n == maxArgsInfinite {
- n--
- }
// Start of the ASCII fast path.
var a []string
na := 0
@@ -662,7 +659,7 @@ func fieldsN(s string, n int) []string {
i++
}
fieldStart = i
- if n != maxArgsInfinite && n <= na {
+ if n != maxArgsInfinite && na+1 >= n {
a = append(a, s[fieldStart:])
return a
}