Skip to content

feat: add scroll-enter-copy-mode option#194

Closed
jun2077681 wants to merge 1 commit into
psmux:masterfrom
jun2077681:feat/scroll-enter-copy-mode-option
Closed

feat: add scroll-enter-copy-mode option#194
jun2077681 wants to merge 1 commit into
psmux:masterfrom
jun2077681:feat/scroll-enter-copy-mode-option

Conversation

@jun2077681

Copy link
Copy Markdown

Summary

Adds a new scroll-enter-copy-mode session option that controls whether mouse scroll-up at a shell prompt automatically enters copy mode.

  • set -g scroll-enter-copy-mode on (default): Existing tmux-compatible behavior — scroll up enters copy mode
  • set -g scroll-enter-copy-mode off: Scrolls the pane scrollback directly without entering copy mode, similar to native terminal scrolling

Changes

  • New boolean session option scroll-enter-copy-mode (default: on)
  • Extracted scroll_pane_scrollback() helper from scroll_copy_up/scroll_copy_down to eliminate code duplication
  • Applied to all 3 scroll entry points: local input (input.rs), remote scroll (window_ops.rs::remote_scroll_wheel), and pane-targeted scroll (window_ops.rs::handle_pane_scroll)

Usage

# In ~/.psmux.conf
set -g mouse on
set -g scroll-enter-copy-mode off

Closes #193

마우스 스크롤 시 copy mode 자동 진입을 제어하는 `scroll-enter-copy-mode` 옵션 추가.
기본값은 `on`(기존 동작 유지). `off`로 설정하면 copy mode 없이 직접 스크롤백 탐색 가능.

- `set -g scroll-enter-copy-mode off`: copy mode 없이 네이티브 스크롤
- `set -g scroll-enter-copy-mode on`: 기존 tmux 호환 동작 (기본값)
- `scroll_pane_scrollback()` 헬퍼 추출로 중복 코드 제거

Closes psmux#193
psmux added a commit that referenced this pull request Apr 9, 2026
When scroll-enter-copy-mode is off, scroll the pane scrollback buffer
directly instead of ignoring the wheel event entirely. This is a much
better UX: users still get scroll history navigation without being
forced into copy mode.

Changes:
  copy_mode.rs   : Extract scroll_pane_scrollback() helper from
                   scroll_copy_up/scroll_copy_down
  input.rs       : Use scroll_pane_scrollback when option is off
  window_ops.rs  : Use scroll_pane_scrollback in remote_scroll_wheel
                   and handle_pane_scroll when option is off
  option_catalog : Add scroll-enter-copy-mode to catalog

Credit: Design inspired by jun2077681 PR #194
@psmux

psmux commented Apr 9, 2026

Copy link
Copy Markdown
Owner

Hey @jun2077681, thank you so much for this pull request! Really appreciate you not only opening the issue but also putting together a working implementation.

Your approach of extracting scroll_pane_scrollback() to directly scroll the buffer when the option is off was genuinely a better design than what I initially had (which was just ignoring the wheel event entirely). That subtle difference makes it so much more usable: users still get their scroll history without being forced into copy mode. Smart call.

I've incorporated your design into the main branch (commit 6bcb9f5) and given you credit in the commit message. The implementation now includes:

  • The scroll_pane_scrollback() helper extracted from scroll_copy_up/scroll_copy_down (your idea)
  • Option catalog entry (which you also caught that I missed)
  • Runtime set -g support, show-options, format variable #{scroll-enter-copy-mode}, and SetOptionUnset reset
  • 7 regression tests covering the full lifecycle

Since the feature is already merged with your approach baked in, I'll close this PR. But the credit is absolutely yours for the core design. Thanks for making psmux better!

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.

Feature request: Option to disable copy-mode on mouse scroll

2 participants