Skip to content

run_screen: opt-in mouse, reported chords and notices (0.8.1) - #28

Merged
YPARK merged 2 commits into
mainfrom
screen-mouse-chords-notice
Oct 6, 2026
Merged

YPARK merged 2 commits into
mainfrom
screen-mouse-chords-notice

Conversation

@YPARK

@YPARK YPARK commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Screen gains default methods that a view opts into. Existing screens keep compiling and behave as before.

  • takes_mouse / mouse: the terminal is asked only for mouse buttons and the wheel (modes 1000 and 1006), not every movement of the pointer, and only when a screen takes the mouse, since capturing it stops text from being selected. Every mouse event goes to mouse, which returns whether the screen changed.
  • reports_chords: asks the terminal (kitty keyboard protocol) to report keys held with Shift, Alt or Ctrl separately from the plain key, so Shift+Enter isn't mistaken for Enter.
  • take_notice: rings the bell and sends a desktop notification (OSC 9, through notify, which strips control characters) once, for whoever is away.

run_screen:

  • takes these modes back while the screen is still up, and asks again after blocking work;
  • handles every event already queued before drawing again, and doesn't redraw for events that change nothing;
  • calls tick on schedule even while events keep arriving, so a stream of them can't stall a view's background work.

run_screen_with(screen, on_key) passes each key (except Ctrl-C) to the caller's function instead of handle_key, for a caller with its own key rules.

Also fixes lints raised by the current clippy (needless borrows in format arguments, sort_by_key, a match guard). Version 0.8.1.

YPARK added 2 commits October 5, 2026 19:52
Screen gains default methods a view opts into: takes_mouse and mouse for
clicks and the wheel, reports_chords for keys held with Shift, Alt or
Ctrl told apart from the bare key, and take_notice for a bell and a
desktop notification. run_screen asks the terminal for these only for a
screen that wants them, takes them back while its screen is up, and
takes events already queued before drawing again. Existing screens are
unchanged.

Also clears lints raised by the current clippy.
The mouse is asked for buttons and the wheel, not every move of the
pointer, and every mouse event goes to the screen, which says whether it
changed. Ticks keep time while events come, so a stream of them cannot
keep a view from its background work. run_screen_with hands keys to a
caller's function rather than handle_key, for a caller with key rules of
its own. Notices go through notify, which drops control characters.
@YPARK
YPARK merged commit 25bafcf into main Oct 6, 2026
5 checks passed
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