summaryrefslogtreecommitdiff
path: root/commands.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
}