If appending to a buffer through writer for example, the cols may not be
correct if the writes don't end up in a newline (\n). Fix this by
keeping track of the cols of previous append.
CodeView widget allows viewing code in a more visually pleasing manner.
It combines LineNumbers widget to provide line numbers on the side.
The CodeView widget allows you to optionally highlight a specific line
and show indentation guidelines.
It is not intended to be a fully fledged editor, but rather for showing
code snippets to a user.
While it is not a fully fledged editor, this widget's code can give you
a good starting point.
The TextView widget provides a simple way to show text content in
a scrollable window.
This implementation does not offer automatic line wrapping for now.
Text content is backed by the Buffer struct. The buffer can be styled
for visually appealing and colorful content, for example to provide
a syntax highlighting.
The buffer provides a writer() interface which allows providing content
from a stream, such as logging.
The ScrollView widget can be used to introduce scrollable elements into
existing widgets.
To use the ScrollView, you must use the ScrollView's writeCell and
readCell functions rather than the ones from Window.
libxev's .rearm semantics are unfortunately not very
portable---rescheduling the exact same event on macOS / kqueue seems
to cause the event loop to hang, while manually rescheduling and
returning .disarm does not.
This loop adds an xev.File wrapper called TtyWatcher which delivers
events to the users callback. Note that this implementation does not
handle any of the writes. Writes are always safe in the main thread, so
we let users decide how they will schedule those (buffered writers, xev
writes, etc)
Attempting to close /dev/tty may block indefinitely on macos if another
thread is already blocked on a read operation. As there is no practical
use for closing /dev/tty on exit besides unblocking other threads (which
does not work on macos anyway) we can just skip the close call.