Commit graph

44 commits

Author SHA1 Message Date
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