len(string) returns bytes, not number of runes, so the "detect single character" clause breaks when passed a multibyte UTF-8 encoding. Casting to rune[] causes it to count runes, and then we can correctly detect the "there is one character in the string" case.
Tested by setting up a multibyte key binding, and then using tmux send-keys -t <pane-specifier> to send key presses to amfora. Looks like this fixes it entirely.
len(string)
returns bytes, not number of runes, so the "detect single character" clause breaks when passed a multibyte UTF-8 encoding. Casting torune[]
causes it to count runes, and then we can correctly detect the "there is one character in the string" case.Tested by setting up a multibyte key binding, and then using
tmux send-keys -t <pane-specifier>
to send key presses to amfora. Looks like this fixes it entirely.