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.
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.
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 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().
This causes colors that are set that are low numbered to
be treated as themed colors -- basically honoring the palette
of the terminal.
The Style and Color implementations have changed quite a bit
to permit growth -- the colors are now 64-bits wide to permit
using the upper bits as flags, and to leave room for a future
alpha channel.
There is a new TrueColor() method on colors that obtains the
value as strict RGB value, and this will be used in lieu of
whatever terminal colors are provided -- giving the application
full control over the color space if they want, without
forcibly clobbering user preferences for terminals for the
vast majority of cases.
Indexed colors are created with the new PaletteColor API.
This works well on the new Windows 10 Terminal, as well as recent
Windows 10 ConHost. Support for this is automatically enabled if
we detect that the terminal supports ANSI escapes, except for
ConEmu, which has a fairly severe scrolling bug with truecolor.
To opt-in anyway, set TCELL_TRUECOLOR to "enable" in your environment.
To opt-out, set TCELL_TRUECOLOR to "disable" in your environment.
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
A gowid user reported that mouse movement in their gowid(tcell) application
was causing the console cursor to flicker on windows, jumping from the current
position in the console to the top left corner, and back again. In part, this
is an artifact of the way I render a gowid "canvas" - calling HideCursor()
unilaterally, then calling ShowCursor(x, y) if the canvas contains a logical
cursor that is within bounds. Because currently every mouse event causes a
gowid application redraw, on windows the effect is to cause the cursor to jump
to the top left briefly, disappear, then reappear in the previous
position. You can see it most easily by moving the mouse rapidly left and
right.
An upstream fix is for me to only call HideCursor() if I know I'm not going to
call ShowCursor(x, y). But the flicker can also be eliminated by removing the
call to setCursorPos(0, 0) in console_win.go before hiding the cursor. The
single call to showCursor() in console_win.go is preceded by setting cursor
coordinates explicitly, so I don't think anything depends on the assumption
that a hidden cursor has been set to position (0, 0) first.
* Fix cScreen.Fini() race condition
Closesgdamore/tcell#158
* Tidy up Windows magic, and fix event ordering
* Move a couple of magic values into constants
* Add more explanatory comments
* Fix ordering WaitForMultipleObjects to give cancellation priority
* Also correct some indentation and minor formatting stuff.
* Use `chan struct{}` for `scandone` to not deadlock
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.