ITADN

`Selection::move_lines` does not go to start when there is only one line of editable text

#608Closedjordanhalase 创建于 2026-04-21
J
jordanhalasecommented
Hello! We are using Parley to implement UI text inputs in Bevy for our 0.19 release very soon, and currently our text inputs are one line long. We currently target Parley v0.8.0 but the problem exists in `main` too. We expected the 'up' key to move the cursor to the beginning of the text, but instead it doesn't move, even though pressing 'down' moves to the end of the text just fine. I tested this in Parley's `vello_editor` example too and see the same problem. If the editable text range is only one line long, then pressing 'up' will no longer to go the start of text. When the user presses the 'up' key we call `PlainEditorDriver::move_up()` in parley/source/editing/editor.rs which internally calls `Selection::previous_line()` in selection.rs, then `Selection::move_lines()`. I've narrowed the problem down to `move_lines()`. The problem is that the first branch of the `if` statement never passes in `move_lines()` to call `line_start()` because `line_limit > 0` is false.
关闭于 2026-04-21 2 条评论