summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2020-10-12 11:45:59 +0200
committerHubert Hirtz <hubert@hirtz.pm>2020-10-12 11:45:59 +0200
commitf5c03fa44ba9a421d5c8eb07781f2bd88b3b0734 (patch)
tree204151e45bbdf20486ec9e16bdfc6099e63b8431 /app.go
parentTyping indicator timeout (diff)
Fix crash when completing nicks with special chars
Not enough space was allocated for the completed text when the word being completed had characters encoded in more than one byte. This was because "word" was a string instead of a []rune, thus "len(word)" counted each byte instead of each character. Fixes #42
Diffstat (limited to 'app.go')
-rw-r--r--app.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/app.go b/app.go
index bd7816e..a27db0f 100644
--- a/app.go
+++ b/app.go
@@ -377,8 +377,8 @@ func (app *App) completions(cursorIdx int, text []rune) []ui.Completion {
}
}
start++
- word := string(text[start:cursorIdx])
- wordCf := app.s.Casemap(word)
+ word := text[start:cursorIdx]
+ wordCf := app.s.Casemap(string(word))
for _, name := range app.s.Names(app.win.CurrentBuffer()) {
if strings.HasPrefix(app.s.Casemap(name.Name.Name), wordCf) {
nickComp := []rune(name.Name.Name)