Skip to content

Commit

Permalink
use strings.CutSuffix on parsing bang of command
Browse files Browse the repository at this point in the history
  • Loading branch information
itchyny committed Oct 12, 2024
1 parent 2349d71 commit bae53f4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cmdline/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ func parse(cmdline []rune) (command, *event.Range, string, bool, string, error)
for k < l && unicode.IsSpace(cmdline[k]) {
k++
}
cmdName := string(cmdline[i:j])
bang := strings.HasSuffix(cmdName, "!")
cmdName = strings.TrimSuffix(cmdName, "!")
cmdName, bang := strings.CutSuffix(string(cmdline[i:j]), "!")
for _, cmd := range commands {
if len(cmdName) == 0 || cmdName[0] != cmd.name[0] {
continue
Expand Down

0 comments on commit bae53f4

Please sign in to comment.