Skip to content

feat(window): add copy_on_select option#82

Open
roramirez wants to merge 1 commit into
mainfrom
feat/config-copy-on-select
Open

feat(window): add copy_on_select option#82
roramirez wants to merge 1 commit into
mainfrom
feat/config-copy-on-select

Conversation

@roramirez

Copy link
Copy Markdown
Owner

Summary

Adds a window.copy_on_select config option (default true, preserving today's behavior) that gates whether a mouse selection is automatically copied to the clipboard. When set to false, dragging a selection or double-clicking a word no longer auto-copies; the user copies explicitly with y / Ctrl+C. The keyboard copy path (Action::Copydo_visual_copy) is unchanged and always copies.

Changes

  • src/config/mod.rs: add copy_on_select: bool to WindowConfig with #[serde(default = "default_copy_on_select")] (default true).
  • assets/config.toml: add copy_on_select = true to [window].
  • src/config/tui_config.rs: add F_COPY_ON_SELECT field to the in-process config panel (label "Copy On Select"), wired through from_config and build_config.
  • src/input/mouse_ops.rs: gate the two mouse-side copy calls (finish_mouse_selection, select_word_at) behind config.window.copy_on_select.
  • Tests: src/input/mouse_ops_test.rs (new) verifies both mouse copy sites honor the flag; updated field-count / round-trip asserts in config_test.rs and tui_config_test.rs.
  • Docs: doc/SPEC.md configuration table, README.md [window] block, CHANGELOG.md.

How to test

  1. cargo test — new mouse_ops tests plus updated config tests pass.
  2. cargo clippy --locked -- -D warnings — clean.
  3. Manual: set copy_on_select = false in ~/.config/mmterm/config.toml, drag-select text or double-click a word, confirm the clipboard is not overwritten; press y in Visual mode (or Ctrl+C) and confirm it copies. Set it back to true and confirm mouse selection auto-copies again.

… copy

Mouse selection (drag release and double-click word-select) copied to the
clipboard unconditionally. Add a config bool `window.copy_on_select`
(default true, preserving current behavior); when false the two mouse-side
copy sites are skipped so the user must copy explicitly via y / Ctrl+C. The
keyboard copy path is unaffected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant