Fix crash when editing non-ASCII text (#3) #23
Loading…
Reference in a new issue
No description provided.
Delete branch "eric/fix-3-non-ascii-input"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #3
Problem: text fields moved the cursor by characters but edited the text by byte position. Accented characters like
étake two bytes, so typingAmélieand then moving the cursor or pressing Backspace could crash the app.Fix:
src/text_input.rswith onehandle_keyfor cursor movement, Ctrl+word jumps, Home/End, Backspace, Delete and typing. The cursor is counted in characters./filter and the new-series name all use it. This replaces three near-identical copies of the logic inhandlers.rs(about 230 lines removed).SeriesCreatorand the episode editor shorten text to fit the screen by whole characters instead of slicing bytes.Testing:
tests/text_input_tests.rsedits "Amélie Poulain" with every key above./filter and the episode Title field with every key. Text and cursor position were right each time, and the app exited cleanly.test_buffer_clearing_performance, an existing timing test (#12).🤖 Generated with Claude Code
https://claude.ai/code/session_01E2XefpQijvBcJBfgzuaoWA