diff options
| author | Robin Gagnon <me@reobin.dev> | 2026-06-01 09:45:55 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-01 17:45:55 +0300 |
| commit | ab649adfded619a0461e36e2eb3929dd5f9e7567 (patch) | |
| tree | 438d1f20ebe73c309c78bb5822effb768476971f /src/selection.rs | |
| parent | bd1d2f7cc5fece3fa91eadb55fb7e0a9f3331780 (diff) | |
fix: preserve linewise copy selection (#389)
refs #360
Co-authored-by: Can Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/selection.rs')
| -rw-r--r-- | src/selection.rs | 26 |
1 files changed, 26 insertions, 0 deletions
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<ScrollMetrics>, + ) -> 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 |
