Commit graph

322 commits

Author SHA1 Message Date
Tim Culverhouse
3a3f7d32cf vaxis: add a logo 2024-05-23 20:16:01 -05:00
Tim Culverhouse
a9a0abf16b window(wrap): fix when we shift to new line
Add a newline at the top of the loop instead of the bottom
2024-05-23 20:15:14 -05:00
Tim Culverhouse
465c01e403 chore: remove TODO from tty 2024-05-23 15:41:59 -05:00
Tim Culverhouse
11dcd099fa tty: correctly handle partial reads 2024-05-23 15:39:08 -05:00
CJ van den Berg
473357f24a parser: don't enable pixel mouse if the terminal explicitly says it doesn't support it 2024-05-23 13:05:36 -05:00
CJ van den Berg
1c11333717 tty: do not close /dev/tty on macos
Attempting to close /dev/tty may block indefinitely on macos if another
thread is already blocked on a read operation. As there is no practical
use for closing /dev/tty on exit besides unblocking other threads (which
does not work on macos anyway) we can just skip the close call.
2024-05-23 12:38:11 -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
CJ van den Berg
a75cce6e78 parser: fix panic on zero mouse coordinate reports 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
CJ van den Berg
8871ca2aef vaxis: add functions to query the terminal and enable features in two steps
This allows better integration with applications that are using a custom
main loop.
2024-05-21 11:12:49 -05:00
Tim Culverhouse
fff034d20a image: remove debug log statement 2024-05-21 08:07:28 -05:00
CJ van den Berg
9906a67ef6 screen: fix off by one error in readCell bounds checks 2024-05-21 06:35:48 -05:00
CJ van den Berg
0333e178bd screen: fix off by one error in writeCell bounds checks 2024-05-17 15:04:31 -05:00
CJ van den Berg
329ba0e43b window: do not attempt to fill offscreen windows 2024-05-17 15:04:31 -05:00
Tim Culverhouse
4f5db2b224 core: apply quirk for termux
Termux spews SGR sequences to the screen if they are not legacy encoded.
Add a quirk for termux (TERMUX_VERSION will be set)
2024-05-17 07:25:06 -05:00
Tim Culverhouse
9d11d13085 window: remove deprecated code, add printSegment 2024-05-16 07:00:41 -05:00
Tim Culverhouse
dea1a875e0 chore: zig fmt 2024-05-12 20:27:24 -05:00
00JCIV00
173ff4e216 Removed old vaxis.zig 2024-05-12 20:25:51 -05:00
00JCIV00
6e97c8d21d Fixed PR Corrections 2024-05-12 20:25:51 -05:00
00JCIV00
ee13f32b17 Removed previously missing (now duplicative) assert declaration 2024-05-12 20:25:51 -05:00
00JCIV00
037a301bd6 Added missing 'assert' definition for TextInput 2024-05-12 20:25:51 -05:00
00JCIV00
ca0371bc44 Updated 'os' to 'posix' for Zig v0.12-3457 2024-05-12 20:25:51 -05:00
00JCIV00
46b82062de Improved the Table Widget
- Added support for creating Tables from `ArrayList([]const u8)`.
- Added the `col_width` field to TableContext to help with Mouse support.
2024-05-12 20:25:51 -05:00
00JCIV00
0329ae9b95 Improved the Table Widget
- Added better Integer bounds checks with Saturated Operators.
- Implemented truncated cells using the "..." suffix.
2024-05-12 20:25:51 -05:00
00JCIV00
96cbae13fc Improved Integer bounds checking with Saturated Operators. 2024-05-12 20:25:51 -05:00
00JCIV00
3e1e6200b4 Added the read_thread to the Vaxis struct and made null handling more idiomatic. 2024-05-12 20:25:51 -05:00
00JCIV00
8d842c8b44 Added some various integer overflow protections 2024-05-12 20:25:51 -05:00
00JCIV00
32a4b4baab Added bounds protection to Alignment Window initialization 2024-05-12 20:25:51 -05:00
00JCIV00
26cd121a75 Reset the 'enter' binding to 0x0D after upstream fix 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
00JCIV00
09a8188851 Added the new Table Widget
- Added `Table.zig` under the `src/widgets` directory and `widgets.zig` module.
- Created the `drawTable()` function to draw a Table to the provided parent Window based on the provided ArrayList.
- Created the `TableContext` struct to manage state and attributes for the `drawTable()` function.
2024-05-12 20:25:51 -05:00
00JCIV00
392dffb307 Made more declarations public in src/Window.zig 2024-05-12 20:25:51 -05:00
00JCIV00
1e30dd7d31 Fixed main.Key.enter binding 2024-05-12 20:25:51 -05:00
Tim Culverhouse
ca4346e35a window(fill): fix bounds check
The bounds check should terminate at the window height.

Fixes: f7f4606f1d "window(fill): bounds check the memcpy op"
2024-05-12 20:24:31 -05:00
Tim Culverhouse
f7f4606f1d window(fill): bounds check the memcpy op
Bounds check our window before performing any direct buffer access. This
affects clear and fill, and allows a window to technically be out of
bounds, but only the visual portion of the window will be filled.
2024-05-11 06:38:08 -05:00
Tim Culverhouse
cce22e8850 options: allow applications to set requested kitty flags 2024-05-10 19:57:02 -05:00
Tim Culverhouse
972129a764 vaxis: apply quirk for vhs
Apply a quirk when in a vhs recording session. Vaxis will automatically
use `wcwidth` and no kitty keyboard
2024-05-09 20:22:45 -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
CJ van den Berg
cde85103a1 window: add readCell method 2024-05-09 06:20:56 -05:00
Tim Culverhouse
bb5d79ef75 core: implement legacy SGR sequences and fallbacks 2024-05-08 13:59:57 -05:00
Tim Culverhouse
48a8aa509c widgets(text_input): protect against zero-width window
A zero-width window could set the text_input.draw method into an
infinite loop. Explicitly protect against this case.
2024-05-06 19:03:07 -05:00
Tim Culverhouse
920e490e4c widgets: add Scrollbar widget 2024-05-06 18:54:35 -05:00
Tim Culverhouse
fa7d94f3df window(print): use const Segment 2024-05-03 13:58:23 -05:00
Tim Culverhouse
6abfd8fc3f render: skip clearing images if they aren't supported 2024-05-03 13:57:03 -05:00
Tim Culverhouse
0fe1142989 widgets(nvim): fix scroll down 2024-05-03 12:30:04 -05:00
Tim Culverhouse
cbfa56bb1b log: remove cursor log lines 2024-05-03 12:12:01 -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
e43f0907ec vaxis: fix InternalScreen.writeCell
writeCell was clearing the retaining capacity of the wrong arraylist
when writing the uri_id.
2024-05-02 10:38:39 -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
6d995fe737 color: change eql to switch statement 2024-04-30 13:38:32 -05:00
Tim Culverhouse
fc9f55d6fa perf: improve perf of fill and Screen.init
Use @memset for initializing and filling a Screen.
2024-04-30 12:33:46 -05:00
Tim Culverhouse
31b97f73d2 tests: fix TextInput test 2024-04-30 09:02:32 -05:00
Tim Culverhouse
5ad01f6a3a image: fix base64 and example 2024-04-30 09:02:16 -05:00
Tim Culverhouse
df2f936317 tty: handle key_release events 2024-04-30 08:55:26 -05:00
Tim Culverhouse
92883f5d42 event: handle key_release events 2024-04-30 08:42:21 -05:00
Tim Culverhouse
cb685f3780 perf: improve equality checks
Improve equality checks during render calls by creating bespoke eql
methods or using std.mem instead of std.meta
2024-04-30 06:50:45 -05:00
Tim Culverhouse
4e3a53c536 widgets(textinput): fix grapheme API 2024-04-29 14:21:03 -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
03f5986c52 window: remove unused code 2024-04-29 09:52:01 -05:00
Tim Culverhouse
bb277b8e37 window: fix word wrapping 2024-04-19 19:31:37 -08:00
Tim Culverhouse
b93a5d2c72 window: change print return value to struct, add commit option
Return more information from `print`. Add `commit` option which does a
"dry run" of printing and returns the size of the wrapped text.
2024-04-19 16:12:52 -08:00
Tim Culverhouse
cda3e1de79 window: mark initChild and wrap as deprecated 2024-04-19 08:10:36 -08:00
Tim Culverhouse
bc206f8716 key: consume num_lock and caps_lock for keymatching
Consume num_lock before keymatching. consume caps_lock for most
keymatches, except for matchText, which will consume caps_lock as
needed.

Fixes: #19
2024-04-17 15:04:50 -08:00
Tim Culverhouse
3a928be693 window: export hasMouse
hasMouse should have been marked pub
2024-04-16 16:06:14 -08:00
Tim Culverhouse
606272f471 widgets: add initial nvim implementation 2024-04-16 16:06:14 -08: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
7ff5251ea3 color: generate color from a u24 2024-04-15 07:15:00 -05:00
Tim Culverhouse
18609912d3 cursor: implement cursor shapes 2024-04-15 07:14:31 -05:00
Tim Culverhouse
d3f22e7612 window: add hasMouse and scroll methods 2024-04-10 14:37:28 -05:00
Tim Culverhouse
e92498002e widgets(textinput): remove log line 2024-04-04 20:34:08 -05:00
Tim Culverhouse
310bff369b widgets(textinput): fix cursor positioning
Fix cursor positioning when jumping more than one cursor location at a
time, for example when pressing "ctrl+a" or "ctrl+e" to go to beginning
and end of the line
2024-04-04 20:14:40 -05:00
Tim Culverhouse
770f6d1c07 parser: fix 0x0A decoding
0x0A should be decoded as Key.enter

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-04-03 19:38:06 -05:00
Tim Culverhouse
4118c5f8bc paste: fix bracketed_paste enabling
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-04-03 18:10:23 -05:00
Tim Culverhouse
8f53700302 key: fix evalquota for name_map 2024-04-03 12:25:34 -05:00
Tim Culverhouse
12ea1bb1e1 key: add name_map 2024-04-03 11:43:04 -05:00
Rylee Lyman
11564484ff fix: delete unused select.zig 2024-04-01 09:42:12 -05:00
Tim Culverhouse
ad18f346eb textinput: make byteOffsetToCursor public 2024-03-30 07:40:08 -05:00
Tim Culverhouse
24e8dccdca key: add isModifier method 2024-03-30 07:37:54 -05:00
Tim Culverhouse
ea6a4a714b widgets(textinput): add inserSliceAtCursor and sliceToCursor
Add two helps methods to textinput:

1. inserSliceAtCursor allows inserting a slice of bytes at the cursor
   position. This allows a program to insert a string at the cursor
   position and allow the internal state of the textinput to properly
   track where the cursor should be
2. sliceToCursor: allow users to obtain an (allocated) slice of the
   content from the beginning of the input to the cursor position
2024-03-29 12:51:41 -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
6a31b71e33 widgets(textinput): properly reset state
Fix resetting of state when calling clearAndFree,
clearRetainingCapacity, or toOwnedSlice.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-26 09:01:07 -05:00
Tim Culverhouse
e37790904f update min zig version, readme 2024-03-21 19:29:26 -05:00
Tim Culverhouse
5e1f9b17a5 window: add child method for cleaner child spawning 2024-03-21 13:54:49 -05:00
Tim Culverhouse
7e23a64aec mouse_shape: set state of last render properly 2024-03-20 10:21:48 -05:00
Tim Culverhouse
981909cce9 tty: remove unused quit_fd field 2024-03-19 13:41:01 -05:00
Tim Culverhouse
a505d67276 core: close read thread via DSR
Request a device status report to trigger a read. Wait for the thread to
join in the main loop to ensure that the read thread has fully closed.
This should prevent the need for polling and a quit_fd, and a separate
mechanism on macos.
2024-03-19 13:41:01 -05:00
Tim Culverhouse
b0944234c6 widgets(textinput): add toOwnedSlice
Add a way to get the contents of the TextInput
2024-03-19 13:25:03 -05:00
Tim Culverhouse
8a5fe1a8ab gwidth: fix gwidth for no_zwj case 2024-03-19 13:20:00 -05:00
Tim Culverhouse
15c64a0e66 textinput: implement horizontal scrolling
Scroll the textinput widget horizontally when it overflows either side.
2024-03-18 08:26:53 -05:00
Tim Culverhouse
f18f6328bb textinput: fix deleteToEnd
Fix behavior of deleteToEnd to delete the character underneath the
cursor to the end of the line.
2024-03-18 08:06:44 -05:00
Tim Culverhouse
8e76610617 fix: catch error on show_cursor 2024-03-17 19:26:42 -05:00
Tim Culverhouse
449eb170f7 fix: always show cursor on deinit
The render method always hides the cursor, and only shows it if it needs
to be shown. This has the effect that if a caller never shows the
cursor, exits the application, and the shell doesn't re-show the cursor
then we have no visible cursor.

Always show the cursor on deinit to prevent such a curse.

Fixes: #10
2024-03-17 09:17:42 -05:00
Rylee Lyman
9496270ecd fix: don't rely on std.time.microTimestamp() for accurate statistics
I don't know the extent to which you care about accuracy for rendering
statistics. I found when working on seamstress that the `timestamp`
calls in `std.time` were so unreliable as to be unusable, sometimes
reporting negative time deltas within a single
function. `std.time.Timer`, on the other hand, has been rock-solid in
my experience.
2024-03-14 07:52:19 -05:00
Tim Culverhouse
1e5560cc09 textinput: add clear methods
Add clear methods to reset the underlying GapBuffer and reset cursor
positions

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-12 07:35:35 -05:00
Rylee Alanza Lyman
0798182012
feat: adds gap_buffer.zig for TextInput (#6)
Use a gap buffer for the `TextInput` widget instead of an `ArrayList`.
2024-03-12 06:38:23 -05:00
Tim Culverhouse
5e940fd295 print: continue on 0 width graphemes or words
Don't print 0 width graphemes or words. Usually these will be
overwritten since we advance by 0 columns, however if one is at the end
of text it can mess up rendering.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-11 19:01:43 -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
cecf774ed2 event: implement pollEvent and tryEvent
Implement a way for an application to poll the event loop in a blocking
way without popping an event. Implement a non-blocking pop. These
together enable an application to poll the event loop and then drain it.
This is useful when lots of events are delivered in a short amount of
time so an application can batch process the events and then render.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-11 09:24:42 -05:00
Tim Culverhouse
22af4908a1 window: fix wrap method
The wrap method was returning a bool from the call to print. Fix this.
2024-03-10 07:48:01 -05:00
Rylee Lyman
c65dab952c fix: use select on macOS
the man page for macOS `poll(2)` says, under "bugs", that polling
devices does not work, and indeed, although the current implementation
based on poll(2) does produce output, it does not appear to actually
be polling for this reason; instead the wait is blocking on the `read`
call, causing the macOS user to need to input another character to
exit.

this change introduces a wrapper over macOS's implementation of
`select`, modeled after `std.io.poll` as `select.zig`. it is a compile
error to use `select.zig` when `builtin.os.tag.isDarwin()` is false. a
lightly altered version of `Tty.zig` accompanies this change. it's
certainly possible to incorporate the two into one file; i didn't just
to leave the other one in its original state.

with this change, writing to the pipe correctly exits.

additionally, on macOS, `Thread.setName` must be called from the
thread whose name you wish to set, so I have just commented out that
line.
2024-03-09 06:45:36 -06:00
Tim Culverhouse
0192860c85 render: reposition cursor when moving to new row
Explicitly reposition the cursor when moving to a new row to enable
terminals that support text selection to _not_ select the entire screen,
since the entire screen is wrapped.
2024-03-07 20:39:37 -06:00
Tim Culverhouse
6dafeb7820 render: check bounds when setting skipped
A double-wide character in the last cell can force this to go OOB.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-06 19:23:47 -06:00
Tim Culverhouse
378984bd87 print: fix bounds for word wrap
Let words go all the way to the end

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-05 15:46:44 -06:00
Tim Culverhouse
7db582b4f3 border: add bottom border
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-05 15:46:30 -06:00
Tim Culverhouse
778346feea render: fix handling of zero-width cells
The render loop could get stuck in an infinite loop when it encounters a
zero width cell. Always set the width to at least 1, and assert this.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-05 15:45:32 -06: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
Tim Culverhouse
e281a67a43 window: add print method
Add a print method with multiple print options

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-01 12:28:29 -06:00
Tim Culverhouse
2fab89f2cb screen: allow reading of cells
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-01 12:28:03 -06:00
Tim Culverhouse
9dae256960 border: add right border
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-01 12:27:49 -06:00
Tim Culverhouse
cf71bb4e7c queue: fix thread safety
Fix thread safety with changes by leeward on IRC. leeward put this code
on sourcehut here: https://hg.sr.ht/~nmichaels/threadsafeq
2024-03-01 12:25:15 -06:00
Tim Culverhouse
dff38f84d1 border: fix all border limits 2024-02-28 16:14:55 -06:00
Tim Culverhouse
ba29a71b3b tty: change logged line to level debug 2024-02-27 07:44:59 -06: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
923c81d7d2 widgets: added table widget
- Added `Table.zig` under the `src/widgets` directory and `widgets.zig` module.
- Created the `drawTable()` function to draw a Table to the provided parent Window based on the provided ArrayList.
- Created the `TableContext` struct to manage state and attributes for the `drawTable()` function.
2024-02-26 19:21:12 -06:00
00JCIV00
b57aab7040 Added the "matchesAny()" method to Keys 2024-02-26 19:21:12 -06:00
00JCIV00
70f1e3495c Changed log.info calls to log.debug for better release builds 2024-02-26 19:21:12 -06:00
00JCIV00
4a87c5f408 Added public Window declaration to main.zig 2024-02-26 19:21:12 -06:00
Tim Culverhouse
f84bad6420 tty: set termios ISIG = false and PARMRK = false
When changing to the new zig termios api, I missed setting two flags.
This left SIGINTs being sent to the terminal and applications not able
to handle ctrl+c.
2024-02-26 18:26:12 -06:00
Tim Culverhouse
9d87579076 key: remove duplicate match rule 2024-02-24 19:42:35 -06:00
Tim Culverhouse
d51530cb73 parser: don't encode tab and enter as ctrl+I and ctrl+m 2024-02-24 19:25:45 -06:00
Tim Culverhouse
981932debd queue: make public 2024-02-24 08:14:12 -06:00
Tim Culverhouse
0d730aba80 queue: update comments, add tryPop
Update comments on queue, and add a tryPop function which is nonblocking

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-02-19 10:11:18 -06:00
drust
6461e6719c Fixed the .len 2024-02-18 21:39:52 -06:00
Tim Culverhouse
8d0f73e951 gwidth: add no_zwj measurement method
Add the no_zwj measurement method which measures the same as unicode,
but strips all ZWJs from the input string. This mimics how Kitty
measures graphemes

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-02-18 12:26:23 -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
c99517181e queue: remove useless defer 2024-02-03 10:05:42 -06:00
Tim Culverhouse
62ee6d1b58 notify, setTitle: flush the buffer
Flush the buffer when calling notify and setTitle
2024-02-03 10:02:04 -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
2b8346f691 tty: shadow os.system with our own switch
When linking lib_c, os.system gets overwritten with std.c. The linux
implementation of std.c doesn't contain the constants we need.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-02-02 11:14:25 -06:00
Tim Culverhouse
927b4120b5 tests: remove finished TODO
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-31 20:07:02 -06:00
Tim Culverhouse
a8e77a23ae keys: finish kitty key definitions
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-31 20:06:02 -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
ad3ef19b87 mouse: add todo
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-31 07:31:27 -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
8c8c592722 parser: handle parsing of apc, sos, pm strings
This lets us detect kitty graphics.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-31 06:59:34 -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
ee85f49bde window: remove old import
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-30 18:23:05 -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