| 1 | ## Breaking Changes in _Tcell_ v3 |
| 2 | |
| 3 | There are a number of changes in _Tcell_ v3, mostly aimed at simplifying things for |
| 4 | applications, but some also intended to reduce the burden for support. Every application |
| 5 | will need at least some changes, but it is expected that those changes will be small, |
| 6 | possibly even mechanical in nature. |
| 7 | |
| 8 | ### Cell and Contents APIs |
| 9 | |
| 10 | In order to improve support for multi-rune grapheme clusters, and to provide an |
| 11 | experience that reduces friction when using it, some APIs have been removed, and |
| 12 | newer APIs exist in their place. |
| 13 | |
| 14 | - `SetCell` and `SetContents` are removed. Use `Put` instead. |
| 15 | - `GetContents` is removed. Use `Get` instead. |
| 16 | |
| 17 | ### Events (PostEvent, PollEvent, ChannelEvents) |
| 18 | |
| 19 | The event channel is now directly exposed via `EventQ`, and events may be read from or written |
| 20 | directly to the channel in the standard Go fashion. This should help applications that want to |
| 21 | integrate into `select` statements (e.g. for timed key presses). |
| 22 | |
| 23 | The `ChannelEvents`, `PollEvent`, `PostEvent`, and `PostEventWait` functions are removed, as |
| 24 | applications can now just access the event channel directly. |
| 25 | |
| 26 | ### Key Event Changes |
| 27 | |
| 28 | `EventKey` now carries a string for `KeyRune` instead of a single rune. |
| 29 | As a result the old `Rune` method for `EventKey` is replaced by `Str`. |
| 30 | The main difference for most users will be that `Str` returns a string, and most |
| 31 | of the time that string will consist of only a single rune. However, it is possible |
| 32 | now to inject synthetic key strokes consisting of multi-rune grapheme clusters. |
| 33 | |
| 34 | Additionally the following special keys are removed, as they are delivered |
| 35 | instead as `KeyRune` with the relevant rune, and the `ModCtrl` modifier: |
| 36 | `KeyCtrlSpace`, `KeyCtrlLeftSq`, `KeyCtrlRightSq`, `KeyCtrlBackslash`, and |
| 37 | `KeyCtrlUnderscore`. |
| 38 | |
| 39 | Note that `KeyRune` will never have a `ModShift` applied unless it is applied |
| 40 | also with other modifiers. |
| 41 | |
| 42 | The `KeyCtrlA` through `KeyCtrlZ` keys are delivered, but will also carry |
| 43 | the associated lower case rune (e.g. "a", "b", etc.) and `ModCtrl`. |
| 44 | |
| 45 | The `KeyBackspace2` key is no longer delivered, but is converted to |
| 46 | `KeyBackspace`. (This resolves some inconsistency around e.g. CTRL-H vs DELETE.) |
| 47 | |
| 48 | When advanced key reporting is enabled, Shift-Tab is reported as `KeyTab` with |
| 49 | `ModShift`, not as `KeyBacktab`. Legacy key reporting still reports Shift-Tab |
| 50 | as `KeyBacktab`. |
| 51 | |
| 52 | ### Termbox Compatibility Removed |
| 53 | |
| 54 | The `termbox` compatibility package is removed. Few applications were using it, |
| 55 | and the compatibility was imperfect. Also the package had limited support for many |
| 56 | newer features. Further, _Termbox_ itself is no longer being maintained. |
| 57 | Applications that still need this should keep using _Tcell_ v2. |
| 58 | |
| 59 | ### Terminfo Removed |
| 60 | |
| 61 | The Terminfo subsystem has been removed entirely. |
| 62 | Essentially the old terminfo based design has long proved to be inferior for modern terminal |
| 63 | applications, and has not kept up with newer terminal features such as 24-bit color, |
| 64 | different mouse reporting modes, bracketed paste, advanced text styling, and so forth. |
| 65 | |
| 66 | As part of this, we're removing the parsed terminfo logic entirely. It turns out that pretty much |
| 67 | all of the terminal logic can be consolidated to just a few classes of terminals with substantial |
| 68 | overlap. |
| 69 | |
| 70 | A consequence of this is that support for some legacy terminals that are either functionally |
| 71 | extinct (such as _hpterm_) or unlikely to be found outside of a museum (such as VT52, Wyse50, or |
| 72 | anything produced more than 40 years ago.) |
| 73 | |
| 74 | Note that VT100 and later will work in emulation, and VT220 and later physical terminals should still work. |
| 75 | VT100 physical terminals may not work, as the padding delays that existed for them are removed. |
| 76 | Those delays hurt emulations that do not need them, and existed only to accommodate limitations found on the |
| 77 | physical hardware from the 1970s. |
| 78 | |
| 79 | Note that we still examine `$TERM` when appropriate, but if the value is not one we recognize, |
| 80 | then we will assume something reasonably capable and compatible at some level with _xterm_ or |
| 81 | at least ECMA-48. |
| 82 | |
| 83 | ### Color, Attributes, Etc. Bit Sizes |
| 84 | |
| 85 | The `Color` type is now only 32-bits, which should save some memory on large terminal windows. |
| 86 | The `AttrMask` type is now only 16-bits, and the `UnderlineStyle` is now 8 bits. |
| 87 | All these lead to further savings in the memory per cell. |
| 88 | |
| 89 | ### Underline |
| 90 | |
| 91 | `AttrUnderline` is gone. It was not sufficient to describe styled and colored underlines. |
| 92 | |
| 93 | ### Removed Capability Queries |
| 94 | |
| 95 | Deprecated APIs `HasKey`, `HasMouse`, and `CanDisplay` are removed. |
| 96 | These functions weren't reliable and served no useful purpose. |
| 97 | |
| 98 | ### Windows Console API |
| 99 | |
| 100 | `NewConsoleScreen` is removed as is support for Windows console mode. |
| 101 | |
| 102 | Instead this uses the more modern Windows VT modes. |
| 103 | As a consequence, this means that _Tcell_ on Windows requires at least Winows 10 build 1703 (the Creators Update). |
| 104 | If you are using a version of Windows 10 older than that, you should really upgrade for _many_ reasons, not just |
| 105 | because _Tcell_ doesn't support it anymore. |
| 106 | |
| 107 | ### InputProcessor is no longer Public |
| 108 | |
| 109 | This structure, and the associated `NewInputProcessor` function, were made public incorrectly. |
| 110 | They are not part of our public API going forward, and are now private symbols. |