Commit graph

44 commits

Author SHA1 Message Date
Tim Culverhouse
04f1586e8f vaxis: add panic handler function
Applications may use this to handle panics gracefully
2024-05-30 09:43:48 -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
3a3f7d32cf vaxis: add a logo 2024-05-23 20:16:01 -05:00
CJ van den Berg
8819e192cc vaxis: export Parser, Tty and getWinsize for applications that cannot use Loop 2024-05-09 19:14:49 -05:00
Tim Culverhouse
31b97f73d2 tests: fix TextInput test 2024-04-30 09:02:32 -05:00
Tim Culverhouse
92883f5d42 event: handle key_release events 2024-04-30 08:42:21 -05:00
Tim Culverhouse
8a71cd4c85 zg: complete replacement of ziglyph with zg 2024-04-29 14:00:08 -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
47160418aa api: export InternalScreen as AllocatingScreen
I'm not thrilled with the name but we'll go with it for now
2024-04-15 07:15:26 -05:00
Tim Culverhouse
c5891399f1 api: export Screen and gwidth
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-11 09:38:52 -05:00
Tim Culverhouse
fa39f0a067 window: saturate size, export Color
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-01 21:29:16 -06:00
Tim Culverhouse
c662de4df0 lib: export Segment, PrintOptions, and ziglyph
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-01 12:28:48 -06:00
00JCIV00
4a87c5f408 Added public Window declaration to main.zig 2024-02-26 19:21:12 -06:00
Tim Culverhouse
981932debd queue: make public 2024-02-24 08:14:12 -06:00
Tim Culverhouse
6418570819 update for zig-0.12.0-2809
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-02-18 12:20:47 -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
eae1036c29 color: export Color and fix bright indexing
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-02-02 16:22:26 -06:00
Tim Culverhouse
3798a8ede3 window: implement wrap and introduce Segment type
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-31 19:13:56 -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
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
626a9101bd images: move to subfolder, use union enum for implementations
There will only ever be a handful of image implementations. Let's just
use a union enum for handling them.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-30 07:14:34 -06:00
Tim Culverhouse
c99dffaecf WIP: images
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-25 13:32:22 -06:00
Tim Culverhouse
85060b001f vaxis: implement mouse shapes
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 13:36: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
a2dc97c039 vaxis: add mode 2027 query parsing, wcwidth measurement
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 21:06:02 -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
44ff960cb0 caps: implement first capability response (kitty keyboard)
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 08:10:59 -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
40525eb038 parser: handle graphemes
I'm not positive this is the final approach. We fill in the `text` field
if there was multi-codepoint text generated from the key_press.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 17:54:44 -06:00
Tim Culverhouse
4ac15e2195 parser: refactor into testable function
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 12:47:34 -06:00
Tim Culverhouse
bef5276340 vaxis: send winsize at run, initialize screen to default cells
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 11:44:20 -06:00
Tim Culverhouse
76b2bf7bbc ctlseqs: add initial ctlseqs
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 10:42:05 -06:00
Tim Culverhouse
c3964fec43 rename project libvaxis
This is so similar to my vaxis project for go that we'll retain the name
here as well. The two can keep similar APIs and feature sets, but are
used in different languages. Maybe someday libvaxis will export a C api
for even broader use

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 10:13:32 -06:00
Tim Culverhouse
e1c042d5ae window: implement initial window data structure
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 06:48:10 -06:00
Tim Culverhouse
266c5ec224 screen: implement initial screen data structure
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 23:18:19 -06:00
Tim Culverhouse
d22b2a89f3 chore: refactor build
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 20:17:26 -06:00
Tim Culverhouse
11b7b86913 core: functional App structure
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 19:02:59 -06:00
Tim Culverhouse
891bab73dd queue: add initial queue and app structure
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 16:16:21 -06:00
Tim Culverhouse
48362a307c tty: use simple os.read loop instead of xev
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-17 22:34:40 -06:00
Tim Culverhouse
b9564b7db8 initial commit
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-17 21:58:03 -06:00