Commit graph

242 commits

Author SHA1 Message Date
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
Tim Culverhouse
edb1fae2ab textinput: add more readline bindings
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-29 07:00:34 -06:00
Tim Culverhouse
96f7bd6044 cell: remove todo
Did this one already

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-28 22:45:37 -06:00
Tim Culverhouse
e6c8be4bd6 render: use provided character width
As a pretty large optimization, use the provided width when possible to
avoid measuring glyphs each render

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-28 22:42:51 -06:00
Tim Culverhouse
a355d7519a fix name
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-28 21:36:30 -06:00
Tim Culverhouse
5c9ce93a63 update ziglyph
update ziglyph to include proper default text emoji with VS16 selector
widths

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-28 21:35:31 -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
8f311da873 vaxis: implement hyperlinks (osc8)
This requires additional allocations anytime there is a hyperlink

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 19:07:05 -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
85060b001f vaxis: implement mouse shapes
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 13:36:24 -06:00
Tim Culverhouse
4c84faddfa vaxis: implement bracketed paste
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 13:23:02 -06:00
Tim Culverhouse
400e2d5cac vaxis: implement osc2 set title
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 13:18:24 -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
8d496ffcdd widgets(textinput): move key handling to ifelse block
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 09:54:22 -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
1b83dfe652 fix: don't use sixel geometry query yet
This query has a response that interferes with key f4. We need to fix
that parsing before doing sixel queries, and we don't even support
sixels yet.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 06:25:45 -06:00
Tim Culverhouse
9f89ed06f3 vaxis: use vt caps to measure grapheme widths
Implement our own grapheme measuring function which switches on whether
the terminal supports mode 2027

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-24 06:12:39 -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
ef7b30dbee render: advance by width of grapheme
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 16:29:44 -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
59470f18e8 vaxis: add sync and refresh
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 07:36:44 -06:00
Tim Culverhouse
5d8f78ccd2 parser: return null events when unhandled
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 07:28:57 -06:00
Tim Culverhouse
8ac44bf3c9 key: implement better keymatching rules
This doesn't handle each case yet, I'm not certain that the rest of the
logic I have in go-vaxis is correct so I want to sit on it some more

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-23 06:35:56 -06:00
Tim Culverhouse
fd97fff931 text_input: add comment about ArrayList not being ideal
Siged-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 20:14:15 -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
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
70e0cafafe window: add hideCursor and showCursor
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 11:18:59 -06:00
Tim Culverhouse
f1a9e21a98 tty: use grapheme cache in the tty run method
We only need the grapheme cache when we are parsing input

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 10:40:30 -06:00
Tim Culverhouse
64557bf9ab parser: use a ring buffer to store raw text
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 10:26:33 -06:00
Tim Culverhouse
393279d978 queue: add tryPush method, a nonblocking push attempt
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-22 09:33:23 -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
558b64544c grapheme_cache: increase cache size
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 18:09:55 -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
0f12881c17 parser: handle non-ascii input
But not full on graphemes, yet

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 16:11:51 -06:00
Tim Culverhouse
25d844702f tty: add events to parser handling, update comment
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 13:20:34 -06:00
Tim Culverhouse
8caa67d5b3 tty: add todo for incomplete parsing
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 13:16:52 -06:00
Tim Culverhouse
244ad8b68e parser: add unit tests
Test (nearly?) implementation so far

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 13:14:30 -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
38b41c4ecf parser: more kitty key parsing
Add some more implementation details to kitty key parsing

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 11:53:25 -06:00
Tim Culverhouse
5df727f77d key: assign certain keys to implicit kitty values
Kitty has implicit private area key values for certain keys. Let's just
use those in our definitions as well

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-21 11:52:10 -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
7c85f72e7f screen: move debug log
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 19:47:08 -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
13e9dadbb1 window: implement fill
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 13:16:53 -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
Tim Culverhouse
1e7c82fe44 vaxis: fix casing of function name
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 12:39:42 -06:00
Tim Culverhouse
79b48e4dea queue: add comment
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 12:28:48 -06:00
Tim Culverhouse
43ea14e263 queue: check for fields before posting events
This allows users of the lib to not worry about having the fields on
their enum

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 12:24:02 -06:00
Tim Culverhouse
811fbdd2cb screen: refactor arg order and fix some math
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 12:21:14 -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
08d2aae5fe cell: set default cell as a space of 1 width
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 11:02:32 -06:00
Tim Culverhouse
02bdcd7625 vaxis: adjust alt screen logic
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 10:59:47 -06:00
Tim Culverhouse
8c8caf4769 tty: enable writing to tty and add smcup in example
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 10:58:14 -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
74d55aaa19 vaxis: fix window initialization
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 10:31:23 -06:00
Tim Culverhouse
959ae27c9f window: add some doc comments
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 10:21:49 -06:00
Tim Culverhouse
9029055de0 window: remove reference to parent
We don't need to keep references to the parent. We only need to
calculate offsets when we initialize a new window.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-19 10:17:11 -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
a9c97d051b tty: implement winch handling
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 22:37:48 -06:00
Tim Culverhouse
3783bcad10 add cell, character, style, color primitives
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 21:03:09 -06:00
Tim Culverhouse
3176eb81ef hack: go to ground state in escape state
Only doing this until I finish the parser

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 20:35:33 -06:00
Tim Culverhouse
27548f7f9d parse: ground parser complete
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-01-18 20:30:42 -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