You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix inverted RTL word/line caret navigation in the subtitle edit box
In a right-to-left subtitle, Ctrl+Left / Ctrl+Right jumped the wrong way and
Ctrl+Up / Ctrl+Down did nothing. Avalonia (and AvaloniaEdit, used when color
tags are on) move whole words by logical text offset, which runs backwards for
RTL text; single-character steps were already visually correct.
Handle these keys in the central OnKeyDownHandler - the same place the edit box
already overrides keys (e.g. the Return-key line limiter) by marking the event
handled in the root tunnel phase, which reliably pre-empts the editor's
built-in navigation. A side TextBox/TextArea handler does not win against
AvaloniaEdit, which is why this lives in the key pipeline instead.
For right-to-left text in the focused edit box (detected by content, per line
with a whole-box fallback - a subtitle is usually edited in an otherwise LtR
window so FlowDirection stays LtR):
- Ctrl+Left / Ctrl+Right move a word in the visually-correct direction.
- Ctrl+Up / Ctrl+Down move to the start / end of the current line.
- Shift extends the selection.
- macOS Option+Left/Right (its native word modifier) is handled too.
Movement goes through the ITextBoxWrapper abstraction, so it works for both the
plain TextBox and the AvaloniaEdit TextEditor edit-box implementations. Left-to-
right text keeps native navigation, and Home / End / Ctrl+Home / Ctrl+End are
untouched.
0 commit comments