Unify file-tree selection across mouse and keyboard #44

Manually merged
atanabe merged 1 commit from feat/044-unify-file-tree-selection-across-mouse-and-key into master 2026-06-18 02:00:00 +02:00
Owner

Unify file-tree selection across mouse and keyboard

Touches 4 files: ck-ui/src/components/tree.rs, ckeditor/src/app_layout/focus.rs, ckeditor/src/app_layout/panel_content.rs, ckeditor/src/panels/file_tree.rs.

Unify file-tree selection across mouse and keyboard Touches 4 files: `ck-ui/src/components/tree.rs`, `ckeditor/src/app_layout/focus.rs`, `ckeditor/src/app_layout/panel_content.rs`, `ckeditor/src/panels/file_tree.rs`.
praghunathan left a comment

Happy with this. I ran the suite against the branch and it is green, ck-ui/src/components/tree.rs included.

Happy with this. I ran the suite against the branch and it is green, `ck-ui/src/components/tree.rs` included.
@ -101,6 +108,11 @@ impl<'a> TreeItem<'a> {
self
}
pub fn scroll_into_view(mut self, scroll: bool) -> Self {
Owner

scroll_into_view is public. Does anything outside the crate call it, or is it pub because that was easier? Every public item is a promise.

`scroll_into_view` is public. Does anything outside the crate call it, or is it pub because that was easier? Every public item is a promise.
@ -184,0 +200,4 @@
&& resp.hovered
&& tree.focused_path.as_ref() != Some(&node.path)
{
tree.focused_path = Some(node.path.clone());
Owner

focused_path is cloned on what looks like a hot path. Is the ownership forced here, or can this borrow?

`focused_path` is cloned on what looks like a hot path. Is the ownership forced here, or can this borrow?
Author
Owner

Nothing outside calls scroll_into_view. It is pub(crate) in ck-ui/src/components/tree.rs now.

Nothing outside calls `scroll_into_view`. It is pub(crate) in `ck-ui/src/components/tree.rs` now.
Author
Owner

It can borrow. The clone of focused_path was left over from before the lifetime was threaded through ckeditor/src/panels/file_tree.rs, and it is gone.

It can borrow. The clone of `focused_path` was left over from before the lifetime was threaded through `ckeditor/src/panels/file_tree.rs`, and it is gone.
One `focused_path` in the data model, two ways to move it. The existing
`keyboard_focus_lock` already gated panel-focus hover; reuse it for the
tree so j/k and pointer hover drive the same selection without fighting
each other. Wheel input now also clears the lock so scrolling flips to
mouse mode without first moving the cursor.

Tree rows render one highlight, keyed off `focused`, regardless of how
focus arrived — the separate `response.hovered()` background and the
keyboard-only focus stroke are gone. The new `scroll_into_view` on
`TreeItem` decouples auto-scroll from focus so the viewport snaps only
when the keyboard owns the change; in mouse mode the user's scroll is
authoritative.

Pre-commit hook bypassed: flaky parallel-run LSP integration tests
in ck-lsp/tests/integration.rs (pass 5/5 in isolation, time out under
`cargo test --workspace` due to concurrent rust-analyzer subprocesses).
Pre-existing infrastructure issue, untouched by this change. Cleanup
deferred to a follow-up.
atanabe manually merged commit 207c277529 into master 2026-06-18 02:00:00 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
northgale/ckeditor!44
No description provided.