Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions crates/base/src/text_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,11 @@ impl WindowSelectionState {
window: Option<&Window>,
cx: &mut Context<Self>,
) {
// A finished gesture keeps its anchor for shift-click extension; only
// a live drag may scroll.
if !self.is_selecting {
return;
}
let Some(anchor) = self.anchor.as_ref().filter(|anchor| anchor.inside) else {
return;
};
Expand Down Expand Up @@ -3143,6 +3148,29 @@ mod tests {
.unwrap();
}

#[gpui::test]
fn pointer_moves_after_a_click_do_not_auto_scroll(cx: &mut TestAppContext) {
let window = cx.add_window(|_, cx| WindowSelectionView {
selection: TextSelectionHandle::new("unused", cx),
});
window
.update(cx, |_, window, cx| {
let state = cx.new(|_| WindowSelectionState::default());
let participant = FakeParticipant::new("participant", cx);
state.update(cx, |state, cx| {
participant.register(state, 0., TextSelectionScopeId::default(), 0, cx);
// A click on text keeps its anchor so shift-click can extend it.
state.begin(point(px(1.), px(1.)), false, cx);
state.end(cx);
assert!(state.anchor.is_some());

state.update_in_window(point(px(1.), px(50.)), window, cx);
assert!(!state.auto_scroll.is_active());
});
})
.unwrap();
}

#[gpui::test]
fn proxy_endpoints_break_equal_position_ties_by_document_order(cx: &mut TestAppContext) {
cx.update(|cx| {
Expand Down
Loading