Allow transcript selection and copying while bottom modals are open (#50564)

## Why

The plan confirmation prompt allowed transcript scrolling but blocked selecting and copying the visible plan text.

## What changed

Allow mouse selection and copying in the visible transcript while a bottom modal is open, preserving drags across redraws. Keep other keyboard input with the modal and suppress transcript link activation, disclosure toggles, and follow-control clicks during modal mouse handling.

## Testing

Extend the plan prompt test to cover selection, `Ctrl+Insert` copying, selection highlighting, and popup bounds. Add coverage confirming that ordinary and Control-clicks do not open links in selection-only mouse handling.

GitOrigin-RevId: 9e1fdfcb4bc18215e62a714f173bc8cb372b090a
This commit is contained in:
Eric Traut
2026-10-03 07:45:47 +00:00
committed by copyberry
parent 58ca099b03
commit b741e480e2
5 changed files with 189 additions and 33 deletions
@@ -306,6 +306,38 @@ fn ordinary_click_opens_bare_and_markdown_links_on_release() {
}
}
#[test]
fn selection_mouse_does_not_open_links() {
for modifiers in [KeyModifiers::NONE, KeyModifiers::CONTROL] {
let (mut view, cells) = transcript("[docs](https://example.com/docs)", /*width*/ 60);
let down = MouseEvent {
modifiers,
..mouse(
MouseEventKind::Down(MouseButton::Left),
/*column*/ 4,
/*row*/ 1,
)
};
assert!(matches!(
view.handle_selection_mouse(down, &cells),
Some(ViewAction::Changed)
));
let area = view.area;
view.render(area, &mut Buffer::empty(area), &cells);
assert!(matches!(
view.handle_selection_mouse(
MouseEvent {
kind: MouseEventKind::Up(MouseButton::Left),
..down
},
&cells,
),
Some(ViewAction::Changed)
));
assert_eq!(view.selected_text(&cells), None);
}
}
#[test]
fn dragging_a_link_selects_text_and_never_opens_it() {
for return_to_origin in [false, true] {