Commit graph

472 commits

Author SHA1 Message Date
Tim Culverhouse
cde1edf39d widgets!: remove border widget
The border widget functionality is replicated in Window.child
2024-10-21 10:21:45 -05:00
Danylo Kondratiev
142131595a widgets.TextView: add intCast 2024-10-16 15:40:55 -05:00
Tim Culverhouse
f01e29ce5c zg: remove grapheme_data init
WidthData already includes grapheme_data. We were double allocating it!
2024-10-14 20:06:06 -05:00
Tim Culverhouse
802b40bdd1 vaxis: remove render stats 2024-10-14 20:01:11 -05:00
Tim Culverhouse
313096c277 window: make print infallible
Print and PrintSegment are now infallible due to gwidth also being
infallible. The previous error was only error.OutOfMemory if a temporary
buffer was too small to encode text in gwidth. This has been removed in
favor or a for loop
2024-10-14 19:24:48 -05:00
Tim Culverhouse
dae0380d65 widget(Table): replace iniChild call 2024-10-14 19:17:51 -05:00
Tim Culverhouse
6d95ab65e6 example(main): fix initChild call 2024-10-14 19:16:25 -05:00
Tim Culverhouse
889b57d7e3 widgets(alignment): replace initChild call 2024-10-14 19:14:51 -05:00
Tim Culverhouse
5f9849363a window!: make initChild private 2024-10-14 18:37:18 -05:00
Tim Culverhouse
ab2b356a1f widget(CodeView): fix int type 2024-10-14 18:28:04 -05:00
Tim Culverhouse
142225a48c cell: change width type from usize to u8
Cell is an often used structure, this should come with some decent
memory savings since there are cells stored twice (Screen and
InternalScreen).
2024-10-14 18:27:16 -05:00
Shem Sedrick
2094e0c364 Adding saturating subtraction for w 2024-10-12 15:59:11 -05:00
Tim Culverhouse
306acc7a2e tty(posix): remove signal handler when we have in-band-resize 2024-10-11 12:11:10 -05:00
Tim Culverhouse
ea5726b1d1 gwidth: use an iterator to prevent returning error
This is a breaking change to gwidth: we no longer return an error
2024-10-08 12:14:26 -05:00
Tim Culverhouse
e3062d62b6 view: move to widgets 2024-10-04 20:13:54 -05:00
Tim Culverhouse
eee2e12644 fixup! examples(view): update view example 2024-10-04 20:13:54 -05:00
Tim Culverhouse
f3c81292b1 examples(view): update view example 2024-10-04 20:13:54 -05:00
Tim Culverhouse
a426b5c96e screen: add error union to return type 2024-10-04 20:13:54 -05:00
Tim Culverhouse
4d5f037e22 view: add draw method, modify allocations 2024-10-04 20:13:54 -05:00
00JCIV00
9615a41d1e widgets(table): zig fmt 2024-10-04 20:13:54 -05:00
00JCIV00
94e28654f9 fix(view): zig fmt on fixes 2024-10-04 20:13:54 -05:00
00JCIV00
0dbd72ef99 fix(view): fixed several items from PR #82 review
- Removed Window allocation in `init()`.
- Changed `max_width` and `max_height` to `width` and `height` in `Config`.
- Removed `x_pixel` and `y_pixel` from `Config`.
- Changed the `win` parameter of `toWin()` to Type `Window`.
- Fixed a typo in `fill()` so that it's no longer a recursion trap.
- Updated the example w/ corresponding fixes.
2024-10-04 20:13:54 -05:00
00JCIV00
ac9839c71d widgets(table): implemented header and column borders
- Added the `header_border` and `col_border` to `TableContext`. Note, row borders don't work as well due to borders taking up an entire cell.
- Updated the `table.zig` example.
2024-10-04 20:13:54 -05:00
00JCIV00
46ecd65c0c widgets(table): implemented header and column alignment
- Added the `header_align` and `col_align` to `TableContext` along with the corresponding `HorizontalAlignment` and `ColumnAlignment` Types.
- Updated the `table.zig` example.
2024-10-04 20:13:54 -05:00
00JCIV00
ad12308a1c view: zig formatted 2024-10-04 20:13:54 -05:00
00JCIV00
28f5734840 view: added 'child()' to View and improved example comments 2024-10-04 20:13:54 -05:00
00JCIV00
d2c9f6337d example(view): made the example more feauture complete and user friendly
- Set up swapable Views for a Small and Large map.
- Created a "Controls" Window at the top of the TUI.
- Added better documentation for how Views work.
2024-10-04 20:13:54 -05:00
00JCIV00
a7fcbe2d73 view: continued initial implementation
- Added proper bounds checking to fit the View within the provided Window.
- Added a simple x/y return Type to the `toWin()` function so users can more easily maintain scrolling bounds.
2024-10-04 20:13:54 -05:00
00JCIV00
94bec1ec2a view: implemented an easy mechanism for vertical and horizontal scrolling
- Implemented View as an easy way to use the existing Screen and Window APIs for rendering Cells that don't fit within a Window. Basically, a user renders the oversized Cell content to a View, then renders a part of that View to a Window.
- Created the `view.zig` example.
2024-10-04 20:13:54 -05:00
Tim Culverhouse
a1b43d2465 core: reset sgr on deinit, and at the end of prettyPrint
Reset SGR unilaterally when deiniting vaxis. Also reset it at the end of
a prettyPrint render.
2024-09-30 10:53:23 -05:00
Jeffrey C. Ollie
1961712c1f TextInput: add ability to draw widget with a style 2024-09-25 11:10:12 -05:00
Jeffrey C. Ollie
2cc1eb77f8 subscribeToColorSchemeUpdates needs a mutable reference 2024-09-23 16:29:42 -05:00
00JCIV00
c89b75ebe3 widgets(table): added ability to reorder and duplicate columns
- Changed the behavior of `ColumnIndexes.by_idx` (used f/ `TableContext.col_indexes`) to allow valid field indexes in any order. Indexes can also be removed or added multiple times to affect the table generation accordingly.
2024-09-12 21:07:41 -05:00
00JCIV00
eaa9c1580a widgets(table): fixed an issue w/ active row contents causing the last few rows to disappear 2024-09-12 21:07:41 -05:00
00JCIV00
2580a8fc12 widgets(table): improved type and bounds checks
- Improved the Type checks for MultiArrayList child Types.
- Improved the bounds checking for printing rows.
2024-09-12 21:07:41 -05:00
00JCIV00
a17c4af217 widgets(table): implemented customizable x offset for cells/items
- Added `cell_x_off` to the `TableContext` to allow changing the X Offset of Cells/Items as they're printed to their rows.
2024-09-12 21:07:41 -05:00
00JCIV00
dbeef72630 widgets(table): implemented customizable foreground colors
- Added `active_fg` and `selected_fg` to allow changing the Foreground Color of Active and Selected rows (and Headers) respectively.
2024-09-12 21:07:41 -05:00
Tim Culverhouse
235e0bb27b vaxis: attempt to reset cursor shape
Attempt to reset the cursor shape on exit, if the shape has been
changed. This won't work on every terminal, however some implement
`\x1b[0 q` as setting the shape to the "default" value, others implement
it as a blinking block.

Fixes: #77
2024-09-10 09:22:42 -05:00
Tim Culverhouse
8263b1e35c widgets(terminal): change pts log to debug
Change an error log of the pts name to be a debug level.
2024-09-05 06:24:24 -05:00
Tim Culverhouse
fa485c740c quirks: set legacy sgr for TERM_PROGRAM=vscode 2024-09-04 04:19:57 -05:00
Tim Culverhouse
e1e3c61cdf osc7: use std.Uri for percent encoding 2024-08-30 06:47:57 -05:00
CJ van den Berg
7dde40d346 fix(windows): don't use getenv("HOSTNAME") on windows 2024-08-30 06:47:57 -05:00
CJ van den Berg
e4655a4ab4 feat: add setTerminalWorkingDirectory (OSC7) 2024-08-30 06:47:57 -05:00
Tim Culverhouse
fcdeb321fe zig fmt 2024-08-15 19:38:14 -05:00
00JCIV00
500488f728 widgets(table): implemented more header and column options
- Added the `HeaderNames` Type and `header_names` field to `TableContext` to let users choose between automatically getting header names from fields or setting custom names.
- Removed the `headers` parameter from `drawTable()`.
- Added the `ColumnIndexes` Type and `col_indexes` field to `TableContext` to let users choose which columns/fields they actually want to display.
2024-08-15 19:37:16 -05:00
00JCIV00
d1b4e3f010 widgets(table): added support f/ enums and slices of strings
- Added proper printing f/ Enums and Slices of Strings into Table cells.
2024-08-15 19:37:16 -05:00
Tim Culverhouse
26072bd85e main: fix test import 2024-08-13 07:45:39 -05:00
Tim Culverhouse
327c2ace82 zig fmt 2024-08-13 07:42:14 -05:00
Tim Culverhouse
54e15764c4 example(table): fix text_input api 2024-08-13 07:42:14 -05:00
00JCIV00
81387ff242 git(fixes): fixed small issue with git rebase
- Reimplemented `col_width` in the Table Widget.
- Readded `*.sw?` to gitignore.
2024-08-13 07:42:14 -05:00