Commit graph

383 commits

Author SHA1 Message Date
Tim Culverhouse
cb685f3780 perf: improve equality checks
Improve equality checks during render calls by creating bespoke eql
methods or using std.mem instead of std.meta
2024-04-30 06:50:45 -05:00
forgoty
019669d2f0 Fix examples: main, pathological, table. 2024-04-29 17:51:33 -05:00
Tim Culverhouse
4e3a53c536 widgets(textinput): fix grapheme API 2024-04-29 14:21:03 -05:00
Tim Culverhouse
8a71cd4c85 zg: complete replacement of ziglyph with zg 2024-04-29 14:00:08 -05:00
Tim Culverhouse
9fec6f122b core: replace ziglyph.GraphemeIterator with zg version
ziglyph is being replaced by zg. Replace all calls to ziglyph grapheme
iterator with the zg version
2024-04-29 13:03:01 -05:00
Tim Culverhouse
e7915b5dd7 examples: fix api for main, pathological, table 2024-04-29 12:35:02 -05:00
Tim Culverhouse
41f76e8f03 vaxis: refactor to split Loop and Vaxis
Refactor the main API to split Loop and Vaxis types. This enables the
core Vaxis type to be more easily referenced in other types, since it
doesn't require a comptime type parameter. This will make the switch to
the zg unicode library easier.
2024-04-29 12:26:50 -05:00
Tim Culverhouse
03f5986c52 window: remove unused code 2024-04-29 09:52:01 -05:00
Tim Culverhouse
bb277b8e37 window: fix word wrapping 2024-04-19 19:31:37 -08:00
Tim Culverhouse
cde945f2ef build: use std.Build.path 2024-04-19 16:22:46 -08:00
Tim Culverhouse
b93a5d2c72 window: change print return value to struct, add commit option
Return more information from `print`. Add `commit` option which does a
"dry run" of printing and returns the size of the wrapped text.
2024-04-19 16:12:52 -08:00
Tim Culverhouse
cda3e1de79 window: mark initChild and wrap as deprecated 2024-04-19 08:10:36 -08:00
Tim Culverhouse
bc206f8716 key: consume num_lock and caps_lock for keymatching
Consume num_lock before keymatching. consume caps_lock for most
keymatches, except for matchText, which will consume caps_lock as
needed.

Fixes: #19
2024-04-17 15:04:50 -08:00
Tim Culverhouse
3a928be693 window: export hasMouse
hasMouse should have been marked pub
2024-04-16 16:06:14 -08:00
Tim Culverhouse
606272f471 widgets: add initial nvim implementation 2024-04-16 16:06:14 -08:00
Tomasz Lisowski
a34d20541e Fix usage example in README 2024-04-16 09:50:43 -05:00
Tim Culverhouse
47160418aa api: export InternalScreen as AllocatingScreen
I'm not thrilled with the name but we'll go with it for now
2024-04-15 07:15:26 -05:00
Tim Culverhouse
7ff5251ea3 color: generate color from a u24 2024-04-15 07:15:00 -05:00
Tim Culverhouse
18609912d3 cursor: implement cursor shapes 2024-04-15 07:14:31 -05:00
Daylin Morgan
b5c2d80f57 build: add build flag for example 2024-04-11 10:39:01 -05:00
Tim Culverhouse
40f80bef0c build: change example to examples/text_input
Will add more example runs later
2024-04-10 14:40:22 -05:00
Tim Culverhouse
d3f22e7612 window: add hasMouse and scroll methods 2024-04-10 14:37:28 -05:00
Tim Culverhouse
e92498002e widgets(textinput): remove log line 2024-04-04 20:34:08 -05:00
Tim Culverhouse
310bff369b widgets(textinput): fix cursor positioning
Fix cursor positioning when jumping more than one cursor location at a
time, for example when pressing "ctrl+a" or "ctrl+e" to go to beginning
and end of the line
2024-04-04 20:14:40 -05:00
Tim Culverhouse
770f6d1c07 parser: fix 0x0A decoding
0x0A should be decoded as Key.enter

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-04-03 19:38:06 -05:00
Tim Culverhouse
4118c5f8bc paste: fix bracketed_paste enabling
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-04-03 18:10:23 -05:00
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
Tim Culverhouse
6301fc6a0f build: add minimum_zig_version 2024-04-01 16:15:18 -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
da988cc8d9 readme: add link to docs page 2024-03-29 09:37:07 -05:00
Tim Culverhouse
910fac9cc2 docs: fix doc build step 2024-03-29 09:20:42 -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
612e298d72 dep: update ziglyph
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
2024-03-21 19:13:56 -05:00
Tim Culverhouse
740f83c07f dep: use upstream zigimg 2024-03-21 19:10:09 -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
d40fb7cbdb examples: clear textinput on enter 2024-03-19 13:24:17 -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