A number of changes were made to Tcell for version two, and some of these are breaking.
The import path for tcell has changed to github.com/gdamore/v2 to reflect a new major version.
The type Style
has changed to a structure, to allow us to add additional data such as flags for color setting, more attribute bits, and so forth.
Applications that relied on being a number will need to be updated to use the accessor methods.
The middle mouse button was reported as button 2 on Linux, but as button 3 on Windows,
and the right mouse button was reported the reverse way.
Tcell now always reports the right mouse button as button 2, and the middle button as button 3.
To help make this clearer, new symbols ButtonPrimary
, ButtonSecondary
, and
ButtonMiddle
are provided.
(Note that which button is right vs. left may be impacted by user preferences.
Usually the left button will be considered the Primary, and the right will be the Secondary.)
Applications may need to adjust their handling of mouse buttons 2 and 3 accordingly.
A number of terminals have been removed.
These are mostly ancient definitions unlikey to be used by anyone, such as adm3a
.
Historically terminfo reported function keys with modifiers set as a different function key altogether. For example, Shift-F1 was reported as F13 on xterm. Tcell now prefers to report these using the base key (such as F1) with modifiers added. This works on xterm and VTE based emulators, but some emulators may not support this. The new behavior more closely aligns with behavior on Windows platforms.
These features are not breaking, but are introduced in version 2.
For terminals that appear to behave like the venerable XTerm, tcell automatically adds modifier reporting for ALT, CTRL, SHIFT, and META keys when the terminal reports them.
When using a color by its name or palette entry, Tcell now tries to use that palette entry as is; this should avoid some inconsistency and undesirable overriding of colors where colors would override settings made in the terminal.
When true fidelity to RGB values is needed, the new TrueColor()
API can be used
to create a color that is precisely the direct color, which bypasses the palette
altogether.
For some terminals, if the Tc
or RGB
properties are present in terminfo,
Tcell will automatically assume the terminal supports 24-bit color.
A new color value, ColorReset
can be used on the foreground or the background
to reset the color the default used by the terminal.