makew0rld / amfora

A fancy terminal browser for the Gemini protocol.
GNU General Public License v3.0
1.16k stars 67 forks source link

Fix issue 198 #200

Closed phaedrus-jaf closed 3 years ago

phaedrus-jaf commented 3 years ago

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.

makew0rld commented 3 years ago

Awesome, thank you!