fixes#578
Also, while here, create a look up table
for performance reasons. This can be suppressed by a new
TCELL_MINIMIZE environment variable, if RAM is precious.
Tcell applications should work out of the box by default
for most users in East Asian locales now.
Commit 43efca775e73 added support for url IDs within OSC8 escape
sequences, however the formatting of the param is incorrect.
Use `id=` instead of `id:`
Fixes: 43efca775e73 ("hyperlinks: add support for optional id parameter")
The WidgetWatchers struct is designed to be embedded into custom widgets
in order to satisfy the WidgetWatcher interface. The implementation uses
an internal map for storing EventHandlers, but does not lock access to
the access of the map within each method. A race condition can occur if
Watch, Unwatch, or any event is Posted from separate goroutines.
Lock access to the internal map. When posting an event, create a deep
copy of the map for iterating. This prevents potential deadlocks from a
widget calling Unwatch while handling an event.
Fixes#553
This function is supposed to return a minimum 2x2 square. However, as the comparison operators are the wrong way around a maximum 2x2 square is returned instead. Inverting the comparison operators fixes the issue.
The 'equal to' comparisons in the `ViewPort.ValidateViewX()` and `ViewPort.ValidateViewY()` methods are not required as the `ViewPort`s corresponding `view` attributes will be set equal to the right operand if the conditional resolves as true. The current behaviour results in the `view` attributes being set unnecessarily if it already equals the limit.
These fix errors discovered while implementing the same logic
in dcell. While here, the conditional support was simplified
using a similar approach as used in dcell, and test cases were
added.
This supports both terminfo (Linux, macOS) terminals, and
the legacy Windows console. Perversely, the "modern" Windows
terminal doesn't support application initiated resizing yet.
fixes#526 tcell emits redundant attributes
This work is inspired by, and partly derived from, work submitted by
Simon Ser (@emersion). However, we've modified the bottom half of
the terminfo parser to better support strings properly, and are using
proper terminfo syntax.
Instead of an attribute called Hyperlink, we have called it Url
for the sake of brevity.
While here we noticed and fixed bug #526, which could badly impact slow
terminals, or slow links. This likely makes things better for folks
coming over long distance SSH connections for example.
We've also provided OSC 8 handling for all terminals which appear to
support the mouse sequences; hopefully ones that don't handle this
sensibly will just ignore it. (Limited testing seems to show this.)
In tcell v2.4, the following calls would reset the screen
to its default color:
1. SetContent() to change the bg color to maroon.
2. Clear()
3. Show()
In tcell v2.5, the behavior changed to clear the screen
to the last-used style passed to SetContent.
This happens because commit 62f5502f set the dirty flag
to false for all cells, on the assumption that sending
ti.Clear would clear the cells anyway. Unlike the drawCell
calls triggered by the dirty flag, however, clearScreen
does not send AttrOff. This causes the screen to clear
to the last-used background color.