mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
trim trailing space from commands
This commit is contained in:
parent
9aeb813cf5
commit
04f0b2c48d
@ -101,9 +101,11 @@ func parseLine(line string) (StringCode, []string) {
|
|||||||
var parts []string
|
var parts []string
|
||||||
if colonIndex := strings.IndexRune(line, ':'); colonIndex >= 0 {
|
if colonIndex := strings.IndexRune(line, ':'); colonIndex >= 0 {
|
||||||
lastArg := norm.NFC.String(line[colonIndex+len(":"):])
|
lastArg := norm.NFC.String(line[colonIndex+len(":"):])
|
||||||
line = norm.NFKC.String(line[:colonIndex-len(" ")])
|
line = strings.TrimRight(line[:colonIndex], " ")
|
||||||
|
line = norm.NFKC.String(line)
|
||||||
parts = append(spacesExpr.Split(line, -1), lastArg)
|
parts = append(spacesExpr.Split(line, -1), lastArg)
|
||||||
} else {
|
} else {
|
||||||
|
line = strings.TrimRight(line, " ")
|
||||||
line = norm.NFKC.String(line)
|
line = norm.NFKC.String(line)
|
||||||
parts = spacesExpr.Split(line, -1)
|
parts = spacesExpr.Split(line, -1)
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SEM_VER = "ergonomadic-1.2.7"
|
SEM_VER = "ergonomadic-1.2.8"
|
||||||
CRLF = "\r\n"
|
CRLF = "\r\n"
|
||||||
MAX_REPLY_LEN = 512 - len(CRLF)
|
MAX_REPLY_LEN = 512 - len(CRLF)
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ func (socket *Socket) readLines(commands chan<- editableCommand) {
|
|||||||
if socket.isError(err, R) {
|
if socket.isError(err, R) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
line = strings.TrimRight(line, "\r\n")
|
line = strings.TrimRight(line, CRLF)
|
||||||
if len(line) == 0 {
|
if len(line) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user