Skip to content

[Phase 7C] Mouse: SGR sequence parsing + output vars #32

@fissible

Description

@fissible

What

Add mouse enable/disable and SGR sequence parsing to shellframe.

  1. shellframe_mouse_enter / shellframe_mouse_exit in src/screen.sh — send \033[?1000h\033[?1006h (enable SGR mouse) on screen enter and \033[?1000l\033[?1006l on screen exit, alongside existing raw mode setup.

  2. SGR mouse sequence parsing in shellframe_read_key (src/input.sh) — SGR format: \033[<Pb;Px;PyM (press) / \033[<Pb;Px;Pym (release). Parse into output variables:

    • SHELLFRAME_MOUSE_COL — column (1-based)
    • SHELLFRAME_MOUSE_ROW — row (1-based)
    • SHELLFRAME_MOUSE_BUTTON — button number (0=left, 1=middle, 2=right, 64=scroll-up, 65=scroll-down)
    • SHELLFRAME_MOUSE_ACTIONpress or release
    • Set SHELLFRAME_KEY to sentinel constant SHELLFRAME_KEY_MOUSE

Files

  • src/screen.shshellframe_mouse_enter, shellframe_mouse_exit
  • src/input.sh — SGR parsing branch in shellframe_read_key

Done criteria

  • Mouse reporting enabled/disabled cleanly around the TUI session
  • Left click, right click, scroll-up, scroll-down all parsed correctly into output vars
  • SHELLFRAME_KEY_MOUSE sentinel set so callers can branch on mouse vs keyboard
  • Unit tests covering SGR parse for press/release/scroll variants
  • IO validation required (CLAUDE.md §5): Write an integration test (or manual test with documented result) that sends a real SGR sequence through a PTY and confirms parsed values — string manipulation tests alone are not sufficient

Effort

S (1–2h)

Deps

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions