Commit graph

25 commits

Author SHA1 Message Date
Tim Culverhouse
3c29f18251 examples(text_input): use all kitty flags 2024-06-05 12:37:27 -05:00
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
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
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
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
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
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
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
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
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