Commit graph

385 commits

Author SHA1 Message Date
Tim Culverhouse
dff7681c30 widgets(terminal): set working_directory at spawn
Fixes #49.

If a user has passed an initial working directory, set that as the
set that as the terminal's working directory when we spawn the widget.
2024-07-05 07:37:16 -05:00
ippsav
09a4de63e5 fix: missing tty.deinit calls 2024-07-05 04:52:33 -07:00
CJ van den Berg
72d96638a4 fix(Parser): prevent index out of bounds error in skipUntilST 2024-07-03 17:30:21 -07:00
CJ van den Berg
b82f4e14b4 feat(windows): parse escape seqences in windows input stream 2024-07-03 17:30:21 -07:00
Rylee Lyman
ca85cbf3b2 fix: use u64 for render_dur so that *Vaxis becomes align(8)
on macOS, `@alignOf(std.c.max_align_t)` is 8, while `@alignOf(i128)`
is 16. since we moved to using `std.time.Timer`, render duration
should always be an unsigned quantity.

this change is motivated by my seamstress project, which wants to use
a Vaxis struct (well, something with a Vaxis struct as a field) as a
Lua userdata. it turns out that Lua won't allocate at an alignment
greater than `@alignOf(std.c.max_align_t)` even if you ask it to.
2024-07-03 04:23:12 -07:00
Tim Culverhouse
2605613019 vaxis: conditionally rely on terminal wrap to reposition cursor
If the text was printed with a wrap, and we can determine this from the
`print` method in Window, then we rely on the terminal for wrapping.
This can help with primary screen text reflowing on resize
2024-07-02 11:27:46 -05:00
Tim Culverhouse
1a52178c1f log: prefix all log scopes with "vaxis" 2024-07-02 08:05:57 -05:00
CJ van den Berg
1e5d39d9b1 fix(windows): unbreak escape sequence handling 2024-07-01 11:55:46 -07:00
CJ van den Berg
c4b5372253 fix(windows): unbreak shifted characters 2024-07-01 11:55:46 -07:00
CJ van den Berg
99942da4e1 fix(windows): fix parsing of UTF-16 codepoints in eventFromRecord 2024-07-01 11:55:46 -07:00
Tim Culverhouse
49ed160268 loop: prevent stopping a stopped loop 2024-07-01 11:17:44 -05:00
Tim Culverhouse
b68864c3ba parser: return early if ss3 contains an escape
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-06-30 16:40:22 -05:00
Tim Culverhouse
763d2a14a3 fix: correct param order for mode 2048 response 2024-06-30 11:53:16 -05:00
Tim Culverhouse
edaeb17f3d feat: implement mode 2048 in band resize reports
Implement mode 2048 for in-band window resize reports.

Reference: https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83
2024-06-30 11:45:43 -05:00
Jari Vetoniemi
9b78bb8a78 aio: update to latest, windows, code reuse
Update to latest aio, which has minor changes such as the thread pool
argument and special aio.ReadTty operation.

In future the aio.ReadTty might have option to translate to vt escape
sequences, but for vaxis it will use the direct mode.

I was not really able to test the windows at all actually as wine did
not seem to play nice with any vaxis example, but it compiles and ...
runs?
2024-06-30 08:44:04 -07:00
Rylee Lyman
9c2d18d5a2 fix: don't call the callback synchronously on watcher init
This makes `xev.TtyWatcher` behave according to my expectations:
namely that the callback will only file after the function which
registers it has returned.
2024-06-30 08:40:58 -07:00
CJ van den Berg
c213919849 tty(windows): fix resize event screen size translation from srWindow 2024-06-27 15:24:09 -07:00
Jari Vetoniemi
b84f9e58a6 vaxis: add aio event loop and example
disabled by default, aio/coro might not be that mature yet.
however, appreciated if people give it a go and report issues.
2024-06-27 08:32:21 -07:00
Tim Culverhouse
935c5a54bc window(wrap): refactor word wrap
Commit 74fb130797 "fix: `Window.printSegments` correctly prints all
non-trailing whitespace" fixed some bugs with word wrapping, but also
introduced a bug with printing leading whitespace in a segment.

Refactor the entire word wrap logic to use a custom LineIterator and a
tokenizer which gives whitespace tokens as well.
2024-06-26 12:40:50 -05:00
Tim Culverhouse
7c03077177 window: use saturating sub in border calcs 2024-06-25 09:07:33 -05:00
Jari Vetoniemi
40e5b673b6 scrollbar: use divCeil to calculate correct height 2024-06-25 06:57:52 -07:00
Rylee Lyman
f7cbd42ed5 fix: pass tests 2024-06-25 06:55:44 -07:00
Rylee Lyman
74fb130797 fix: Window.printSegments correctly prints all non-trailing whitespace
I'm told it's not unusual in the web world for multiple whitespace
characters to be consumed as a single space. If that is the intention
for `.word` wrap, that's fine with me! If not, this PR correctly
prints all non-trailing whitespace.

I also chose to consume a `\r\n` sequence as intending a single newline,
while all other sequences of `\r` and `\n` should produce multiple newlines.
2024-06-25 06:55:44 -07:00
Tim Culverhouse
fcb705adaa mouse: remove translateMouse debug log 2024-06-24 12:47:45 -05:00
Rylee Lyman
b2151349ad feat: add col_offset to Window.print
this commit adds convenience to `Window.print` by allowing it to
start printing at a nonzero column.
2024-06-21 02:57:58 -07:00
Tim Culverhouse
6e85cd1fca quirks: remove asciinema quirk
Asciinema now recognizes ':' delimiters

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-06-20 14:32:45 -05:00
Tim Culverhouse
3b06180fdb key: remove unused buffer and len 2024-06-19 09:50:01 -05:00
Tim Culverhouse
0c91840b32 widgets(terminal): implement OSC 7 for pwd reporting 2024-06-19 09:23:11 -05:00
Tim Culverhouse
7005bb237c widgets(terminal): add initial_working_directory option 2024-06-19 07:11:02 -05:00
Tim Culverhouse
6043f0569a widgets(terminal): remove error logs
And use a buffered writer in the example
2024-06-18 18:41:48 -05:00
Rylee Lyman
f25a9b9660 fix: deinit TTY to avoid stair-stepped output 2024-06-13 12:34:03 -07:00
Tim Culverhouse
975dd01a77 readme: add supported operating systems 2024-06-13 12:51:49 -05:00
Rylee Lyman
f57ba4b477 fix: add ThreadPool for key events on macOS 2024-06-13 07:40:24 -07:00
Tim Culverhouse
254cc0aac0 ci: use mlugg/setup-zig 2024-06-13 08:19:15 -05:00
CJ van den Berg
3a0392c282 tty(windows): fix mouse wheel direction calculation 2024-06-13 05:59:11 -07:00
Tim Culverhouse
36696e8785 tty(windows): parse mouse events 2024-06-13 07:16:46 -05:00
CJ van den Berg
790dbaae24 build: allow building on freebsd 2024-06-13 04:17:45 -07:00
Tim Culverhouse
f230f0c30a widgets(terminal): send a redraw event 2024-06-12 19:29:19 -05:00
Tim Culverhouse
8f4ca5b830 tty(windows): enable_extended_flags
Note: we still need to parse the events.
2024-06-12 11:15:16 -05:00
Tim Culverhouse
cea5798db9 widgets(terminal): ensure only one sigchild handler installed 2024-06-12 06:36:07 -05:00
Tim Culverhouse
bf0828f9ef build: update minimum zig version 2024-06-11 20:41:02 -05:00
Tim Culverhouse
46e7fd8fc6 widgets: remove neovim widget
The neovim widget was great. But we have a full virtual terminal widget
now, which doesn't bring in extra dependencies.
2024-06-11 20:35:10 -05:00
Tim Culverhouse
88d6c76fa8 fix(readme): restore vaxis.gif 2024-06-11 20:32:39 -05:00
Tim Culverhouse
96387d43e6 build: change neovim default to true
Commit ec98c7cd3d fixed the default value to match the description,
however this resulted in the docs failing to build since the files are
needed in the default build case.

Update the default and description to true.
2024-06-11 20:29:18 -05:00
Frederico Winter
ec98c7cd3d changed the default value of the nvim option to correspond to it's default description 2024-06-11 18:27:00 -07:00
Tim Culverhouse
9c723bb645 examples(vt): use shell environment for command 2024-06-11 19:09:55 -05:00
Tim Culverhouse
389ac3ef40 widgets(terminal): clean up accidentally included files 2024-06-11 14:07:01 -05:00
Tim Culverhouse
6d4c180e31 widgets(terminal): implement legacy key encoding 2024-06-11 14:00:37 -05:00
Tim Culverhouse
7954e8c9ba build: use upstream zg
My commit for replacement characters was merged
2024-06-11 14:00:02 -05:00
Tim Culverhouse
37b0d5c69d widgets(terminal): read full codepoints
Only read full codepoints. Some programs will split codepoints between
reads, which can mess with our parser (looking at you, btop)
2024-06-11 13:59:07 -05:00