Commit graph

380 commits

Author SHA1 Message Date
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
Tim Culverhouse
eeb69f012a widgets(terminal): fix cursor showing 2024-06-11 10:28:07 -05:00
Tim Culverhouse
05f52ed4ee widgets(terminal): implement escapes, fix scrollDown 2024-06-11 10:27:18 -05:00
Tim Culverhouse
b688732f56 widgets(terminal): use buffered reader in parser
Use a buffered reader so we can inspect the read state. We need this to
know if we have a finished read on a printable byte
2024-06-10 15:07:04 -05:00
Tim Culverhouse
9f2af4d5ee widgets(terminal): implement even more csi sequences 2024-06-10 14:18:55 -05:00
Tim Culverhouse
3ab3edf6bf widgets(terminal): use zg fork 2024-06-10 14:18:32 -05:00