fix: support UTF-8 characters in hotkey matching

- Fix key_matches() to use chars().count() instead of len()
- This correctly handles multi-byte UTF-8 characters (russian layout)
- All 9 config tests now pass (was 7/9, now 9/9)

Fixes:
- test_hotkeys_matches_char_keys
- test_hotkeys_matches_russian_vim_keys

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Kilin
2026-02-01 00:00:00 +03:00
parent 1b70b12799
commit 2b18d5a481

View File

@@ -287,7 +287,8 @@ impl HotkeysConfig {
} }
} }
// Символьные клавиши (буквы, цифры) // Символьные клавиши (буквы, цифры)
key_char if key_char.len() == 1 => { // Проверяем количество символов, а не байтов (для поддержки UTF-8)
key_char if key_char.chars().count() == 1 => {
if let KeyCode::Char(ch) = key { if let KeyCode::Char(ch) = key {
if let Some(expected_ch) = key_char.chars().next() { if let Some(expected_ch) = key_char.chars().next() {
if ch == expected_ch { if ch == expected_ch {