
@tslocum reported that the commit at 2d6d7fbe broke mouse support in cview (https://github.com/gdamore/tcell/pull/384#issuecomment-698422464). The purpose of the original commit was to fix a terminfo background color code parsing problem that I spotted using TERM=xterm-16color: $ infocmp xterm-16color | grep setab setab=\E[%?%p1%{8}%<%t%p1%'('%+%e%p1%{92}%+%;%dm, The middle sections says "if p1<8 then push(p1+'(') ". '(' is ascii 40. The sequence '%d' will then pop from the stack and interpreting the result as an integer. My change above was to have tcell assume the sequence between two single quotes was a single ASCII character e.g. '(' and push that to the terminfo stack as an integer with the ASCII value of the character e.g. push(40:int). I didn't find any counterexamples in my local terminfo database that didn't line up with that assumption; but I did break mouse support because tcell generates its own rules to enable mouse support, if not specified in the terminfo DB - both when generating its own Golang-style internal DB, and in the dynamic terminfo generator that uses infocmp: "%?%p1%{1}%=%t%'h'%Pa%e%'l'%Pa%;\x1b[?1000%ga%c\x1b[?1002%ga%c\x1b[?1003%ga%c\x1b[?1006%ga%c" This rule will push 'h' or 'l', depending on whether mouse mode is to be enabled or disabled, and then sets the variable named a to the result, interpreted as a string. The result is that when mouse mode is enabled, tcell needs to emit \x1b[?1000h - where the 'h' comes from variable a i.e. it needs to be able to push a quoted argument as a string and not be forced into an int. This alternative fix preserves the fact the quoted argument is a string and maintains that on the stack. However, if the integer Pop() function is called when the top element of the stack is a string, tcell will now - return the string converted to an int, if it converts e.g. in the case '123' is pushed to the stack as a string and popped as an int, the value is 123 - otherwise return the ASCII value of the first character of the string e.g. if '(' is pushed then popped as an int, the value returned is 40. To be compatible with this logic, if a terminfo rule needs to push an integer whose value is >= ascii('0')==48 and <= ascii('9')==57, it will need to use the form e.g. {53} and not '5' because the form '5' will be pushed as "5":string and if popped as an int will return the value 5 and not 53.
This package represents the parent for all terminals.
In older versions of tcell we had (a couple of) different external file formats for the terminal database. Those are now removed. All terminal definitions are supplied by one of two methods:
-
Compiled Go code
-
For systems with terminfo and infocmp, dynamically generated at runtime.
The Go code can be generated using the mkinfo utility in this directory. The database entry should be generated into a package in a directory named as the first character of the package name. (This permits us to group them all without having a huge directory of little packages.)
It may be desirable to add new packages to the extended package, or -- rarely -- the base package.
Applications which want to have the large set of terminal descriptions built into the binary can simply import the extended package. Otherwise a smaller reasonable default set (the base package) will be included instead.