This is not supported for Windows or WebAssembly yet.
It's possible for applications to post to the clipboard using
Screen.SetClipboard (any data), and they can retrieve the clipboard
(if permitted) using GetClipboard. The terminal may well reject either
of these.
Retrieval will arrive as a new EventClipboard, if it can. (There is
no good way to make this synchronous.)
This work was inspired by a PR submitted by Consolatis (#562), and
has some work based on it, but it was also substantially improved and
now includes both sides of the clipboard access pattern.
This adds a new optional parameter to screen.SetCursorStyle,
which is a color. The cursors demo is enhanced to show this.
This ability is supported on screen types, provided the underlying
terminal supports the capability.
This centralizes much of the logic (hopefully reducing duplication)
for polling events and the queue. This will make it easier to make
further design changes to express a better, simpler, API to consumers.
While here addressed missing logic to handle Fini correctly on Windows.
A lot of functionality is duplicated across screen implementations,
and adding convenience methods is onerous because one needs to touch
each implementation with what is mostly copy-paste coding.
This represents the start of refactoring to eliminate redundant code
from each implemenation and provide for it in a common layer.
Extend the Screen interface with a new Tty method, which returns the
underlying tty when the screen is a terminal. This enables direct
drawing to the Tty.
Implement the interface for the three screen implementatinos included in
the library.
Extend the Screen interface with a new LockRegion method. This method
sets or unsets a lock on a region of cells. This will be used in
subsequent commits to enable direct drawing to the underlying TTY. The
locks are necessary in order to prevent cells from being drawn on top of
a directly drawn cell.
Implement this interface for the three screen implementations included
in the library.
This supports both terminfo (Linux, macOS) terminals, and
the legacy Windows console. Perversely, the "modern" Windows
terminal doesn't support application initiated resizing yet.
This adds a new method, SetCursorStyle() to the screen API.
It also automatically restores the cursor when disengaging to
the default cursor. Modern terminals (and Windows console) support
this.
This adds names to the return values of the Size function to add
context. This also changes the return declarations to use the shortcut
when both named return values are the same type, by only specifying the
type once.
fixes#194 Starting multiple screen sessions (lost key event)
You can test this by using the mouse demo, which now supports pressing
CTRL-Z. This does not actually suspend the demo, but starts a subshell
which takes over. After the subshell is exited, the demo takes control
of the screen back. This can be done multiple times, and it is possible
to start multiple "nested" iterations of the demo this way.
At some point in the future this is going to be replaced with
a simpler channel design, and the current blocking approach
is both non-idiomatic, and fragile. Don't use it.
This adds optional MouseFlags that can be used to adjust what is
tracked for mouse reporting (leaving the other modes to be handled
by the terminal.) This should work on all XTerm style terminals,
but on Windows we have no way to be selective here.
This does sort the main problem of screen.Fini(), but really we
want to use a separate Pause() and Resume() function, because
screen.Fini() is not meant for reuse in this way.
Note that one side effect of this change is that applications which
redirect stdin and stdout and expect us to just use /dev/tty instead
are going to break -- we are now using stdin and stdout like nearly
every other screen oriented application.
This adds Bracketed Paste support for terminals that have mouse
support and support it. The bracketing events are EventPaste,
with methods to note Start() or End() of the paste. Content
comes in as normal rune events. Programs must opt-in to this by
calling screen.EnablePaste().
Add a Beep() method to the Screen interface. On *nix systems, this
writes the bell character (0x07) to the tty. On Windows, we call the
MessageBeep syscall.
Fixes: #2
We had problems where if $TERM was set on a Windows console, we would
fail to allocate the screen because of missing termios. This caused
lots of problems for many Windows users. This should make this easier
for folks who might have set $TERM for other reasons, even in a Windows
console environment.
Eventually we will want to support emitting characters for 256 color
support, but that's later.
fixes#38 Broke wide characters in last update
fixes#39 Clean up logic for encodings, enhance fallback options
fixes#36 Support more mouse buttons on Windows.