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
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
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.
The render method always hides the cursor, and only shows it if it needs
to be shown. This has the effect that if a caller never shows the
cursor, exits the application, and the shell doesn't re-show the cursor
then we have no visible cursor.
Always show the cursor on deinit to prevent such a curse.
Fixes: #10
I don't know the extent to which you care about accuracy for rendering
statistics. I found when working on seamstress that the `timestamp`
calls in `std.time` were so unreliable as to be unusable, sometimes
reporting negative time deltas within a single
function. `std.time.Timer`, on the other hand, has been rock-solid in
my experience.
Don't print 0 width graphemes or words. Usually these will be
overwritten since we advance by 0 columns, however if one is at the end
of text it can mess up rendering.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Implement a way for an application to poll the event loop in a blocking
way without popping an event. Implement a non-blocking pop. These
together enable an application to poll the event loop and then drain it.
This is useful when lots of events are delivered in a short amount of
time so an application can batch process the events and then render.
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>