From ab649adfded619a0461e36e2eb3929dd5f9e7567 Mon Sep 17 00:00:00 2001 From: Robin Gagnon Date: Mon, 1 Jun 2026 09:45:55 -0500 Subject: fix: preserve linewise copy selection (#389) refs #360 Co-authored-by: Can Celik --- src/selection.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/selection.rs') diff --git a/src/selection.rs b/src/selection.rs index b2e37c3e..6a05dc6c 100644 --- a/src/selection.rs +++ b/src/selection.rs @@ -78,6 +78,32 @@ impl Selection { } } + pub(crate) fn line_range( + pane_id: PaneId, + anchor_row: u32, + cursor_row: u32, + end_col: u16, + ) -> Self { + let (anchor_col, cursor_col) = if anchor_row <= cursor_row { + (0, end_col) + } else { + (end_col, 0) + }; + Self { + pane_id, + anchor: (anchor_row, anchor_col), + cursor: (cursor_row, cursor_col), + phase: Phase::Dragging, + } + } + + pub(crate) fn absolute_row_for_viewport( + viewport_row: u16, + metrics: Option, + ) -> u32 { + absolute_row_for_viewport_row(viewport_row, metrics) + } + /// Convert the anchor's absolute row and pane-relative column back to /// screen coordinates. Adds the pane origin before clamping so the /// returned (screen_row, screen_col) can be compared directly against -- cgit v1.2.3