Commit c9ec473
feat(widgets): add textarea, left-bordered box, and blocks spinner (#109)
* feat(widgets): add textarea, left-bordered box, and block spinner
- Add Textarea_widget: multiline text input with Shift+Enter for newlines,
cursor navigation, line joining on backspace/delete, scroll support
- Add render_left_border_box: opencode-style box with colored left border
and background color
- Add Block spinner style: animated block cursor ([ ] [▌] [█] [▐]) in a box
- Extend Spinner_widget with style parameter (Dots or Block)
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(widgets): add textarea, left-bordered box, and blocks spinner
- Add Textarea_widget: multiline text input with Shift+Enter for newlines,
cursor navigation, line joining on backspace/delete, scroll support
- Add render_left_border_box: box with colored left border and background,
useful for context sections or quoted content
- Add Blocks spinner style: size + color gradient progression trail
- Lead: ■ (large), trail: ▪ • · (shrinking)
- Configurable direction (Left/Right)
- Configurable block count
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(input): add Alt+Enter key parsing for textarea newlines
Replace ShiftEnter with AltEnter since most terminals don't send
distinct escape sequences for Shift+Enter. Alt+Enter (ESC followed
by newline) is universally supported.
- Add AltEnter key variant to input_parser
- Update textarea widget to use A-Enter/Alt-Enter keys
- Update demos and documentation
- Bump version to 0.3.1
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(widgets): add mouse support (wheel scroll + click)
Add comprehensive mouse support to widgets:
- New Mouse helper module with event parsing utilities
- Pager: wheel scroll, click to position cursor (in cursor mode)
- Select: wheel scroll, click to select item
- File Browser: wheel scroll, click to select entry
- Textbox: click to position cursor
- Textarea: wheel scroll, click to position cursor
- Tabs: click to select tab
- Breadcrumbs: click on crumb to navigate
- Button/Link: click to activate/navigate
- Checkbox/Radio/Switch: click to toggle
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(demos): wire mouse events to launcher and widget demos
- Launcher: wheel scroll moves selection, click opens demo
- Modals (select, poly_select, file_browser, textbox): forward mouse
events via handle_modal_key since they don't parse as typed keys
- Demos (pager, link, switch, validated_textbox): forward mouse events
to their widgets
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(mouse): improve click handling and add double-click support
- Fix click vs selection: single clicks now dispatch to widgets instead
of starting text selection. Actual text selection requires dragging.
- Add double-click/triple-click event types (DoubleClick:, TripleClick:)
which are passed to widgets for handling
- Fix Escape key handling in all demos: use Keys.Escape variant instead
of Char "Esc" which was never matched
- Add modal click coordinate translation: store rendered modal position
and translate screen coordinates to widget-relative coordinates
- File browser: single click selects, double-click opens folder/file
- Select widget: fix click handling to account for scroll offset and
top indicator line
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(matrix): remove unnecessary mark_all_dirty from mouse handlers
Remove mark_all_dirty calls from MousePress, Mouse release, and MouseDrag
handlers to fix screen flickering on mouse events.
The back buffer is cleared and re-rendered every tick (30 TPS), with
apply_highlight adding selection styling based on current state. The
render domain (60 FPS) diffs front vs back and updates only changed
cells. When selection changes or clears, the diff naturally detects
and updates affected cells without needing a forced full redraw.
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(box_widget): add per-side border colors
Add border_colors parameter with c_top, c_bottom, c_left, c_right fields
to allow different colors for each border side. Useful for indicating
multiple states (e.g., selection on top/left, status on bottom/right).
Corner colors prefer top/bottom colors when both adjacent sides have colors.
When border_colors is provided, it takes precedence over the color parameter.
* fix(pager): add ANSI reset and wrap-aware scrolling
- Add ANSI reset at end of each rendered line to prevent color spill
- Fix ensure_cursor_visible to account for wrapped line heights
* fix(mouse): write enable sequence to /dev/tty for consistency
The enable_mouse function was writing to stdout while all other matrix
driver terminal operations write to /dev/tty. This inconsistency could
cause buffering mismatches and race conditions leading to screen flicker.
Now enable_mouse writes to tty_out_fd first (with tcdrain to ensure
delivery), then to stdout as fallback, matching the pattern used by
disable_mouse for reliability.
Co-Authored-By: Claude <noreply@anthropic.com>
* feat(signals): add install_signals' with optional SIGINT handling
Add install_signals' variant that accepts ~handle_sigint:bool parameter.
When false, SIGINT is not intercepted, allowing apps to receive Ctrl+C
as a key event instead of immediate exit.
The original install_signals is preserved unchanged (delegates to
install_signals' with ~handle_sigint:true).
* fix(matrix): remove screen clear from periodic scrub to prevent flicker
The periodic scrub was clearing the entire screen with ESC[2J before
redrawing, causing visible flicker. Instead, just mark all cells dirty
and let the diff-based renderer overwrite them naturally.
* feat(config): add handle_sigint option to control Ctrl+C behavior
Add handle_sigint field to Matrix_config.t (default: true). When false,
SIGINT is not intercepted, allowing apps to receive Ctrl+C as a key
event ("C-c") instead of immediate exit.
Propagates through Matrix_input.create and Matrix_driver.
* feat(runner): add handle_sigint option to Runner_tui.run
Allows apps to disable SIGINT handling so Ctrl+C is received as a key
event ("C-c") instead of immediately exiting.
* fix(terminal): disable c_isig in raw mode and ignore SIGINT when not handling
Two changes to make Ctrl+C receivable as a key event:
1. Set c_isig=false in raw mode to prevent terminal from generating
SIGINT on ^C - this allows the character (ASCII 3) to be read
2. When handle_sigint=false, explicitly ignore SIGINT to prevent
default termination behavior
Together these allow apps to receive Ctrl+C as "C-c" key event.
* docs(changelog): document new widgets and signal updates
Add changelog entries for signal handling options, Box_widget per-side border
colors, and recent driver/mouse/pager fixes on the new-widgets branch.
* chore(release): bump new-widgets to 0.3.2
* fix: copyright year, comment typo, spinner glyph and docs
- Fix copyright year 2025 → 2026 in mouse.ml/mli
- Fix comment "Shift+Enter" → "Alt+Enter" in textarea_widget.ml
- Fix spinner_widget.mli docs: Blocks renders a single line, not 3
- Implement glyph parameter in render_blocks_glyph (was ignored)
Circle: ● ○ • · and Dot: • ∙ · · variants now work
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent cd5db5e commit c9ec473
File tree
93 files changed
+2065
-279
lines changed- example
- demos
- bar_chart
- box_widget
- braille
- breadcrumbs
- button
- canvas
- card_sidebar
- checkbox
- description_list
- flex_layout
- grid_layout
- key_handling
- layout_helpers
- line_chart
- link
- logger
- miaou_invaders
- pager
- palette
- radio
- sparkline
- spinner_progress
- switch
- system_monitor
- table
- tabs
- textarea
- toast
- tree
- validated_textbox
- gallery
- modals
- src
- miaou_core
- miaou_driver_common
- miaou_driver_matrix
- miaou_helpers
- miaou_internals
- miaou_runner
- miaou_widgets_display
- miaou_widgets_input
- miaou_widgets_layout
- test
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
93 files changed
+2065
-279
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
8 | 43 | | |
9 | 44 | | |
10 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
| 67 | + | |
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
58 | 66 | | |
59 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
| 123 | + | |
126 | 124 | | |
127 | 125 | | |
128 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 63 | + | |
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 48 | + | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
249 | | - | |
| 247 | + | |
250 | 248 | | |
251 | 249 | | |
252 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 57 | + | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
| |||
0 commit comments