szn

Bug 379 — Bare click in copy-mode exits the mode and litters buffers

379. Missing movement guard on the copy-mode click path

File: src/server/server.zig:1637-1641 (press), src/server/server.zig:1662-1671 (release) Severity: MEDIUM Status: ✅ FIXED

Fix (applied)

The copy-mode press handler starts a selection and records anchor press coords (Server.copy_click_x/y) whenever !cm.selection.active or !m.drag. On release:

Test: bare click in copy-mode stays in mode, drag still yanks — bug #379 (asserts press/release at identical coords keeps copy-mode active and resets selection.active; consecutive bare clicks at different locations remain in mode without yanking; drag across cells yanks one buffer and exits).

Problem

A bare click starts a zero-extent selection, then release yanks it (a single character or empty string after the trailing-space trim at mode_copy.zig:384-386) onto the paste-buffer stack and kicks the user out of copy mode. Without clearing the selection on a non-moving release, subsequent bare clicks or keyboard motions erroneously treated the selection as active.

Fix (proposed)

On release require actual movement since press (compare cursor_x/y at press, stored alongside start_scroll_offset) before yank+exit; a no-move release should just clear the selection highlight (clearSelection) and stay in copy-mode.