diff options
author | Hubert Hirtz <hubert@hirtz.pm> | 2020-10-12 11:45:59 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2020-10-12 11:45:59 +0200 |
commit | f5c03fa44ba9a421d5c8eb07781f2bd88b3b0734 (patch) | |
tree | 204151e45bbdf20486ec9e16bdfc6099e63b8431 /app.go | |
parent | Typing 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.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) |