Skip to content

Add rectangular block selection and clipboard copy; refactor rendering and update deps#16

Merged
enijburg merged 1 commit into
mainfrom
codex/implement-mouse-click-clipboard-actions
May 15, 2026
Merged

Add rectangular block selection and clipboard copy; refactor rendering and update deps#16
enijburg merged 1 commit into
mainfrom
codex/implement-mouse-click-clipboard-actions

Conversation

@enijburg

Copy link
Copy Markdown
Owner

Motivation

  • Add support for rectangular (block) selections and enable copying block selections to the system clipboard.
  • Simplify and centralize character rendering logic to correctly account for left-column clipping and visible width.
  • Update dependency graph to pull in clipboard/graphics/image-related crates required for clipboard and block rendering features.

Description

  • Introduced block selection state on Viewer with block_selection_anchor and block_selection_focus, plus a block_selection_range() accessor and line_display_chars() helper to map visual columns to characters.
  • Implemented rectangular copy behavior in a new copy_selection_to_clipboard() function that handles both block and linear selections and updates viewer.status_message on success or failure.
  • Updated mouse handling to start a block selection when left-clicking with Ctrl, to update block focus while dragging, and to copy on right-click; linear selection behavior is preserved otherwise.
  • Refactored inline push_char logic into a top-level push_char() helper used by render_line() to handle left-column clipping, visible width limits, and segment building.
  • Clear selection now resets both linear and block selection state, and render_line() will include block selection when computing highlight segments.
  • Updated Cargo.lock with additional dependencies (clipboard/GUI/image/PNG/TIFF related crates and windows targets) required by the new clipboard and block selection implementation.

Testing

  • Built the project with cargo build and the build completed successfully.
  • Ran unit tests with cargo test and all tests passed.
  • Performed integration sanity checks by running the application and exercising mouse-based linear and block selections and the copy-to-clipboard flow, with expected status messages appearing.

Codex Task

@enijburg enijburg merged commit 66f4c5a into main May 15, 2026
2 checks passed
@enijburg enijburg deleted the codex/implement-mouse-click-clipboard-actions branch May 15, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant