Commit graph

549 commits

Author SHA1 Message Date
Tim Culverhouse
22fab6f38b image: fix image scaling s/win.height/win.width 2024-07-20 14:03:24 -05:00
InKryption
53374f4f09 Remove incorrect pointer capture 2024-07-20 09:49:14 -05:00
Tim Culverhouse
2882264fa3 image: fix transmission of rgb and rgba
We must send image dimensions for these particular formats
2024-07-19 14:20:09 -05:00
Tim Culverhouse
9f8ef6270b re-export zigimg 2024-07-19 13:43:11 -05:00
Tim Culverhouse
2b5b58b255 image: allow transmitting zigimg Images directly
And with other transmission formats
2024-07-19 13:34:49 -05:00
Tim Culverhouse
20bbb25727 loop: null event continues inner loop 2024-07-19 11:44:09 -05:00
Tim Culverhouse
0e06467a61 mouse: don't translateMouse if we have 0 sized screen 2024-07-19 09:48:39 -05:00
Tim Culverhouse
1b9fcb1fa2 readme: add starter repo 2024-07-19 09:12:45 -05:00
Tim Culverhouse
c3ba0bbb16 loop: fix another loop continuuation 2024-07-19 07:43:44 -05:00
Tim Culverhouse
37941e59f5 loop: continue read_loop on null event 2024-07-19 07:41:14 -05:00
Tim Culverhouse
b513fff3b4 loop: fix capture for key_release 2024-07-19 07:07:50 -05:00
Tim Culverhouse
25b145a569 deps: reference commit for GapBuffer.zig 2024-07-18 07:36:19 -05:00
Jari Vetoniemi
56757fadcc aio: update aio, add LoopWithModules
AFAIK zig lacks a way of overriding module dependencies of dependencies.
LoopWithModules lets you use aio backend with vaxis using aio and coro
modules that are not included by vaxis, when this function is used
`include_aio` is not neccessary.
2024-07-16 10:42:57 -05:00
Tim Culverhouse
40e51ad054 fix(underline): use correct style value in switch 2024-07-09 13:05:37 -05:00
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