3
0
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:
Jeremy Latt 2014-02-26 16:17:44 -08:00
parent 9aeb813cf5
commit 04f0b2c48d
3 changed files with 5 additions and 3 deletions

View File

@ -101,9 +101,11 @@ func parseLine(line string) (StringCode, []string) {
var parts []string
if colonIndex := strings.IndexRune(line, ':'); colonIndex >= 0 {
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)
} else {
line = strings.TrimRight(line, " ")
line = norm.NFKC.String(line)
parts = spacesExpr.Split(line, -1)
}

View File

@ -23,7 +23,7 @@ var (
)
const (
SEM_VER = "ergonomadic-1.2.7"
SEM_VER = "ergonomadic-1.2.8"
CRLF = "\r\n"
MAX_REPLY_LEN = 512 - len(CRLF)

View File

@ -53,7 +53,7 @@ func (socket *Socket) readLines(commands chan<- editableCommand) {
if socket.isError(err, R) {
break
}
line = strings.TrimRight(line, "\r\n")
line = strings.TrimRight(line, CRLF)
if len(line) == 0 {
continue
}