Repository navigation
LT-22688: Arrow keys move between writing systems - #1181
Conversation
Tab stopped at every writing system of a multistring field and at every paragraph of a structured-text field in Avalonia. The WinForms DataTree has one tab stop per field and moves between writing systems with the arrow keys. * Update Avalonia behavior to use arrow keys instead of tab stops to move between WSs. DetailValueStopGroup (new), used by FwMultiWsTextField and FwStructuredTextField: only the first enterable editor is a Tab stop. Up and Down move to the next or previous writing system (or paragraph) from the last or first visual line. Left and Right do the same at the text edges, and an empty value moves at once. Shift+Tab from a later editor leaves the field. Tab entry puts the caret at the start of existing text instead of selecting all of it. FwMultiWsTextField's navKeyDown handles every Left/Right press itself, so it now asks the group first; relying on handler order left the edge crossing unreachable in editable rows. * Fix ReferenceVectorField highlighting. FwReferenceVectorField: the current item stayed highlighted after focus moved on, until another vector row selected an item. The highlight is now painted only while focus is inside the field, a menu gesture is in progress, or one of the item's own menus is open. The item still stays current for menus. DetailMenuRequest: BeginMenuGesture and EndMenuGesture now reach the row's selection source even without a text editor, so a read-only item stays highlighted while its right-click menu is open. * Add tests. DataTreeTabNavigationIntegrationTests.cs: replaced the test that expected Tab to visit every writing system, and added tests for Up/Down, Left/Right, Shift+Tab, structured-text paragraphs and caret placement. DetailMenuTests.cs: added the highlight tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
NUnit Tests 1 files 1 suites 13m 45s ⏱️ Results for commit 1e0d9b3. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1181 +/- ##
=========================================
+ Coverage 0 39.62% +39.62%
=========================================
Files 0 1541 +1541
Lines 0 354887 +354887
Branches 0 41175 +41175
=========================================
+ Hits 0 140616 +140616
- Misses 0 184880 +184880
- Partials 0 29391 +29391
🚀 New features to boost your workflow:
|
Include the new focus-tracking handler in the handler count for the ReferenceVector_ReadOnly_WiresOnlyTheItemSelectHandlers test.
Comment hygiene (advisory)No comment-style violations in the lines this branch adds since |
A structured-text paragraph computed its right-to-left direction only for the read-along per-run-font display, and only when the paragraph needed one. The editor was always left-to-right, so an RTL paragraph flipped direction when it took focus, and the arrow keys crossed to the next paragraph at the wrong edge. FwStructuredTextField.cs: added IsFirstRunRightToLeft, which reads the first run's writing-system font, and used it to set the paragraph TextBox's FlowDirection when it is created. CreateValueContentWithFontSwap now reads the direction back from the box, so the display and the editor cannot disagree. DetailValueStopGroup already reads the box's FlowDirection to decide which arrow advances, so it needed no change. DataTreeTabNavigationIntegrationTests.cs: added tests that an RTL paragraph, with and without a per-run-font display, takes its direction and crosses on Left at its logical end and on Right at its logical start, but not on the opposite keys. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A structured-text paragraph set its editor's FlowDirection once, when the editor was created. Editing away an RTL first run left the paragraph right-to-left, so the arrow keys crossed to the neighboring paragraph at the wrong edge. FwStructuredTextField.cs: replaced IsFirstRunRightToLeft with FirstRunRightToLeft, which returns null when the first run is missing, untagged, or has no font. After each successful TrySetParagraphText, WireParagraphTextEditing sets FlowDirection from the new first run when the result is not null. Otherwise the direction is kept, so emptying an RTL paragraph and retyping does not flip it mid-edit. DataTreeTabNavigationIntegrationTests.cs: added tests that editing away an RTL first run flips the paragraph to the new first run's direction, that emptying an RTL paragraph keeps it RTL, and that replacing text in an RTL first run keeps it RTL. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Suggestion: add a test for Up/Down in text that wraps
One test would cover both. Use a narrow window and a value long enough to wrap to three lines, then check:
Not blocking. The single-line behavior is well covered, and this would protect the wrapped case against layout changes. |
thejambi
left a comment
There was a problem hiding this comment.
@thejambi reviewed 7 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on aror92).
Every Up/Down test used short single-line values, so the two layout-dependent branches of DetailValueStopGroup never ran: IsOnEdgeLine, which decides whether the arrow stays inside a wrapped value or moves to the next writing system, and CaretNearX, which picks where the caret lands. DataTreeTabNavigationIntegrationTests.cs: added UpAndDownInWrappedText_MoveWithinTheValueBeforeLeavingIt. In a narrow window with two long values, it checks that Down from the first line stays in the box and moves to the second line, that Down from the last line moves to the next writing system's first line near the same horizontal position, and that Up from there returns to the previous value's last line. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
thejambi
left a comment
There was a problem hiding this comment.
@thejambi reviewed 3 files and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on aror92).
Fix Avalonia tab traversal in multistring fields. Rather than having a tab stop at every writing system of a multistring field and at every paragraph of a structured-text field in Avalonia, use one tab stop per field and move between writing systems with the arrow keys (matching WinForms behavior).
Fix highlighting in reference vector fields. Once focused on, a reference vector field would remain highlighted until another reference vector field was selected. The highlight is painted now only while the field or one of its menus is in focus.
Update Avalonia behavior to use arrow keys instead of tab stops to move between WSs:
DetailValueStopGroup (new), used by FwMultiWsTextField and FwStructuredTextField: only the first enterable editor is a Tab stop. Up and Down move to the next or previous writing system (or paragraph) from the last or first visual line. Left and Right do the same at the text edges, and an empty value moves at once. Shift+Tab from a later editor leaves the field. Tab entry puts the caret at the start of existing text instead of selecting all of it.
FwMultiWsTextField's navKeyDown handles every Left/Right press itself, so it now asks the group first; relying on handler order left the edge crossing unreachable in editable rows.
Fix ReferenceVectorField highlighting:
FwReferenceVectorField: the current item stayed highlighted after focus moved on, until another vector row selected an item. The highlight is now painted only while focus is inside the field, a menu gesture is in progress, or one of the item's own menus is open. The item still stays current for menus.
DetailMenuRequest: BeginMenuGesture and EndMenuGesture now reach the row's selection source even without a text editor, so a read-only item stays highlighted while its right-click menu is open.
Add tests:
DataTreeTabNavigationIntegrationTests.cs: replaced the test that expected Tab to visit every writing system, and added tests for Up/Down, Left/Right, Shift+Tab, structured-text paragraphs and caret placement. DetailMenuTests.cs: added the highlight tests.
This change is