Skip to content

Conversation

@mathiasbourgoin
Copy link
Collaborator

Summary

Add Input_drain capability so textbox widgets can process all buffered printable
characters at once, preventing lag when typing fast.

Problem

When typing quickly in a textbox, characters could buffer up in the terminal input and
each keystroke triggered a full render cycle. This caused noticeable lag between
typing and seeing characters appear.

Solution

  • Add Miaou_helpers.Input_drain module with drain_pending_chars() function
  • Driver registers a drain function at startup that reads buffered printable chars
  • Textbox_widget.handle_key drains and applies pending chars after each keystroke

Changes

  • src/miaou_helpers/input_drain.ml / .mli: New capability module
  • src/miaou_driver_term/lambda_term_driver.ml: Register drain function
  • src/miaou_widgets_input/textbox_widget.ml: Use drain in handle_key

Test plan

  • dune build passes
  • dune runtest passes
  • Fast typing in textbox feels responsive

Add Input_drain capability so textbox widgets can process all buffered
printable characters at once, preventing lag when typing fast.

- Add Miaou_helpers.Input_drain module with drain_pending_chars()
- Driver registers drain function at startup
- Textbox_widget.handle_key drains pending chars after each keystroke
- Validated_textbox uses the same mechanism

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.

2 participants