Commit graph

59 commits

Author SHA1 Message Date
Tim Culverhouse
5f41978054 refactor(vaxis): require an io.AnyWriter for writes
All vaxis functions that write to the terminal now require an
io.AnyWriter as a parameter
2024-05-29 13:13:54 -05:00
Tim Culverhouse
59abd7d7d4 refactor(vaxis): move tty out of vaxis
Refactor to move the tty out of the vaxis struct. All vaxis writes now
take an io.AnyWriter
2024-05-29 11:33:39 -05:00
Tim Culverhouse
0fa082033e examples: add readline example 2024-05-24 11:00:35 -05:00
Tim Culverhouse
409e17b883 examples: add vaxis example 2024-05-24 08:04:54 -05:00
CJ van den Berg
55809160b9 vaxis: detect pixel mouse mode and translate coordinates to cell offsets
This detects support for pixel mouse mode so it can be enabled only
if supported.

This also translates pixel coordinates to something more compatible
with plaine cell coordinates. This make it much easier to write
applications that support both.
2024-05-22 15:04:26 -05:00
Tim Culverhouse
1b957ec84e fix examples, update readme features 2024-05-22 14:09:15 -05:00
CJ van den Berg
d48826c0b1 vaxis: add osc52 copy/paste support 2024-05-22 13:51:19 -05:00
Tim Culverhouse
a1263b1baa mouse: enable pixel tracking 2024-05-21 15:00:14 -05:00
Tim Culverhouse
1dc90bd764 image: use image options struct, add more functionality
Use an options struct for controlling image output. Add more
functionality from the core kitty image protocol
2024-05-21 11:14:07 -05:00
00JCIV00
d75c44725e Added the basic example for pausing the TUI with a Child Process. 2024-05-12 20:25:51 -05:00
00JCIV00
a07d4f19a7 Reorganized Namespaces
- Consolidated `main.zig` into `vaxis.zig` as the new library entry point.
- Exposed more Types throughout the library for more transparent doc navigation.
- Reorganized certain Modules and Types to be more coherent and readable.
- Re-generated docs to reflect these changes.
2024-05-12 20:25:51 -05:00
00JCIV00
f8544be262 Added the table.zig example
- Created a basic user management example for the Table widget.
2024-05-12 20:25:51 -05:00
Tim Culverhouse
bb5d79ef75 core: implement legacy SGR sequences and fallbacks 2024-05-08 13:59:57 -05:00
Tim Culverhouse
6abfd8fc3f render: skip clearing images if they aren't supported 2024-05-03 13:57:03 -05:00
Tim Culverhouse
ed1867cf39 examples(nvim): update example api
The nvim widget needs work, but at least you can run the example
2024-05-02 20:13:45 -05:00
Tim Culverhouse
a0db41f87c render: add cli renderer
Add a renderer for applications running on the primary screen. This
renderer uses relative cursor positioning, and works with all the same
primitives as the alternate screen.

Fix a bug where repositioning was never turned back to false. This was a
nasty one with huge perf implications.

Set internal cells to a space and default on init. This prevents us from
writing them. As a result, we now issue a hardware clear on resize.
2024-05-02 12:50:33 -05:00
Tim Culverhouse
50242b984b loop: fully clean up tty when stopping event loop
Previously, stopping the read thread would not fully clean up the tty.
This could result in issues such as #9 where the terminal state was
borked upon return to shell or if temporarily exiting the TUI.

Fixes: #9
2024-04-30 16:42:10 -05:00
Tim Culverhouse
2d48093d3a examples(pathological): improve printing of time 2024-04-30 12:57:29 -05:00
Tim Culverhouse
5ad01f6a3a image: fix base64 and example 2024-04-30 09:02:16 -05:00
forgoty
019669d2f0 Fix examples: main, pathological, table. 2024-04-29 17:51:33 -05:00
Tim Culverhouse
9fec6f122b core: replace ziglyph.GraphemeIterator with zg version
ziglyph is being replaced by zg. Replace all calls to ziglyph grapheme
iterator with the zg version
2024-04-29 13:03:01 -05:00
Tim Culverhouse
e7915b5dd7 examples: fix api for main, pathological, table 2024-04-29 12:35:02 -05:00
Tim Culverhouse
41f76e8f03 vaxis: refactor to split Loop and Vaxis
Refactor the main API to split Loop and Vaxis types. This enables the
core Vaxis type to be more easily referenced in other types, since it
doesn't require a comptime type parameter. This will make the switch to
the zg unicode library easier.
2024-04-29 12:26:50 -05:00
Tim Culverhouse
606272f471 widgets: add initial nvim implementation 2024-04-16 16:06:14 -08:00
Tim Culverhouse
117545ca4b window: add custom border location option
Add a way to draw borders in custom locations
2024-03-26 15:11:20 -05:00
Tim Culverhouse
d40fb7cbdb examples: clear textinput on enter 2024-03-19 13:24:17 -05:00
00JCIV00
e87d64a2b3 Added the table.zig example
- Created a basic user management example for the Table widget.
2024-02-26 19:27:56 -06:00
00JCIV00
b7d7ba6b36 example: s/start/startReadThread s/stop/stopReadThread 2024-02-26 19:06:05 -06:00
Jora Troosh
4a463cfa3a
refactor: make code more idiomatic
- Added standard .gitattributes file for Zig projects.
- Reworked build.zig a little, hopefully it's a bit clearer. Also, now zig build will run all steps.
- outer: while in examples was redundant since there's only one loop to break from. switch expressions don't allow breaking from them, so breaking is only for loops, i.e. while and for.
- When returning a struct instance from a function, the compiler infers the return type from function signature, so instead of return MyType{...}; , it's more idiomatic to write return .{...};.
- Logging adds a new line by default, so you don't usually need to write \n like here: log.debug("event: {}\r\n", .{event});.
2024-02-11 12:59:33 -06:00
Tim Culverhouse
a733860a21 add pathological example as a terminal perf test 2024-02-09 12:27:22 -06:00
Tim Culverhouse
f3cf7bcfcd mouse: implement mouse parsing and events
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-31 12:50:00 -06:00
Tim Culverhouse
43f73eb895 image: implement deleting images from memory
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-31 07:18:16 -06:00
Tim Culverhouse
23a00ede55 images: kitty support works well
We still need to handle querying for support.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-30 20:51:54 -06:00
Tim Culverhouse
f901dde2a0 images: kitty image protocol works
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-30 16:26:35 -06:00
Tim Culverhouse
cc75fe6272 image: implement transmitting images
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-30 13:30:36 -06:00
Tim Culverhouse
9950c9eac5 vaxis: mode cleanup, initial mouse implementation
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 18:36:45 -06:00
Tim Culverhouse
33d43dc6d1 vaxis: implement osc9 and osc777 notifications
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 13:15:04 -06:00
Tim Culverhouse
35fcbd05d7 update example
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 10:20:00 -06:00
Tim Culverhouse
b57342726f parser: parse 0x08 as backspace
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 06:45:24 -06:00
Tim Culverhouse
04f6117cfe vaxis: enable da1 parsing, use futex timeout to return from query
Now that DA1 parsing is done, block the queryTerminal function until the
DA1 response is received, or a 1 second timeout elapses. With this
functionality, move certain events into Vaxis's realm of handling: IE
enabling kitty keyboard, unicode mode, etc

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 21:30:09 -06:00
Tim Culverhouse
aaa1c17a81 key: enable kitty keyboard
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 13:25:31 -06:00
Tim Culverhouse
59470f18e8 vaxis: add sync and refresh
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 07:36:44 -06:00
Tim Culverhouse
d2f02897dc render: use different internal model of screen
We use two screens: one which the user provides a slice of bytes for the
graphemes, and the user owns the bytes. We copy those bytes to our
internal model so that we can compare between frames

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 20:09:35 -06:00
Tim Culverhouse
1b7608f469 examples: update text_input
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 11:24:09 -06:00
Tim Culverhouse
c9c704d4a7 render: fix when we set current cursor to new style, update examples
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 11:19:28 -06:00
Tim Culverhouse
5148d20f52 widgets: create an initial text_input and border widget
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 19:12:46 -06:00
Tim Culverhouse
93d9ead99c parser: more progress on CSI parsing
Add additional CSI parsing for keys

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-20 08:05:22 -06:00
Tim Culverhouse
462a303903 examples: add some comments
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 22:02:10 -06:00
Tim Culverhouse
de91cbe2d0 render: complete the render loop
This loop matches the go version of Vaxis to a tee. :chefs-kiss:

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 19:43:35 -06:00
Tim Culverhouse
58bc6864cb render: implement double buffered screen for rendering
This lets us efficiently render by only updating cells that have changed
since last render

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 13:13:20 -06:00