Commit Graph

24 Commits

Author SHA1 Message Date
Garrett D'Amore 652ba11803 mkinfo typo for DottedUnderline 2024-03-07 06:10:54 -08:00
Garrett D'Amore ed7527708c Forgot to commit mkinfo.go 2024-03-04 19:59:29 -08:00
Garrett D'Amore 1fb8cfe768 feature: underline styles
This supports now curly, double, dashed, and dotted underline styles
where trhe terminal supports it.  This works well on Windows Terminal,
reasonably on iTerm2, Alacritty, Kitty, and probably others.

The wasm mode terminal includes support for this, dependent on the browser
capabilities.

The macOS Terminal just changes the background color.  Legacy Windows
console does nothing.

We will try to provide a regular underscore as a fallback.  A new style.go
demo is included to see some style combinations.
2024-03-03 19:04:45 -08:00
Garrett D'Amore 216e30afd7 fixes #679 Some emojis move entire line upwards when at bottom of terminal
This fix is not perfect, in that it will not fix every terminal that has
automargin support, but it fixes the *vast* majority of them by eliminating
the hacky workaround for the automargin - essentially using the rmam capability
to disable automatic wrapping at the margin.
2024-02-15 23:53:05 -08:00
Garrett D'Amore d25117a2e5 Go fmt for the project. 2022-08-31 11:37:42 -07:00
Garrett D'Amore 761abf6821 fixes #356 Vim cursors shapes?
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.
2021-09-28 20:05:18 -07:00
Garrett D'Amore c43eafe245 Fix for writing in last column of last line for automargin terminals. 2021-05-18 23:17:00 -07:00
Garrett D'Amore 13bc6c2778 fixes #420 RFE: Mouse wheel only reporting
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.
2021-01-24 15:18:06 -08:00
Trevor Slocum da485f4734 Rename StrikeOut as StrikeThrough 2020-08-31 08:55:31 -07:00
Garrett D'Amore 368f8e092b fixes #376 Need ColorReset
This provides a ColorReset color that resets the color to
the default for the terminal.
2020-08-30 22:57:00 -07:00
Garrett D'Amore 9d283802ab fixes #350 Add strikeout support 2020-08-30 20:25:30 -07:00
Garrett D'Amore bf3f269ccb fixes #373 Check for and use RGB property in terminfo
This also regenerated some definitions, which should lead to
more accurate mouse mode for a few of the terminals.
2020-08-30 19:33:25 -07:00
Garrett D'Amore 84d0c5503d fixes #369 Better support for modifier keys
This replaces high numbered function keys on xterm style
emulators with modifiers.  So pressing SHIFT-ALT-F1 is
reported as exactly that, for example.  This also extends
that to the insert, delete, home, end, etc.

There is a chance that this will break some emulators --
of particular concern are older VTE based emulators and
rxvt (and derivatives).  However, we think that most VTE
derivatives are now much more closely aligned to xterm.

The Wyse50 alternate character set was changed (likely
due to a bug fix in ncurses).
2020-08-30 02:11:39 -07:00
Garrett D'Amore 8a32d2b0c8 Version 2.0 work in progress. 2020-08-25 16:20:58 -07:00
Nojus Gudinavičius 8572f72a22 Add support for italics 2020-04-13 07:15:39 -07:00
Vedran Vidović bac2bbc5b3 Adding Shift modifier for PgUp/PgDn
Implemented key kombination of Shift + PgUp/PgDn for Gnome terminal.
Same combination copied to all other terminal implementations which use same
codes for Shift + Up/Down but since this is tested on Ubuntu 16.04 with Gnome
Terminal 3.18.3 it could be that it is not correctly implemented for some of the
other terminals.
2020-02-05 21:47:23 -08:00
Graham Clark de4e5c4494 Fix control-character encoding for non-alphabet characters
@klamonte opened this issue against gowid, a package that relies on tcell for
all its terminal handling: https://github.com/gcla/gowid/issues/24. It
describes how a shell inside a terminal widget that the TUI launches freezes
when the user hits backspace. The TUI loads a tcell TermInfo struct for the
screen-256color terminal and that struct codes KeyBackspace as the single byte
0xff - and so the byte 0xff was sent to the tty. On my Ubuntu 19.04 machine,
`infocmp screen-256color` shows `kbs` is `^?` According to
https://en.wikipedia.org/wiki/Caret_notation, `^?` should map to 0x7f (127) -
"The digraph stands for the control character whose ASCII code is the same as
the character's ASCII code with the uppermost bit, in a 7-bit encoding,
reversed". This affects both mkinfo.go, the generator of the JSON terminfo
database files, and the dynamic terminfo generator.
2020-01-13 20:44:03 -08:00
Garrett D'Amore 1922b3786e fixes #252 database cannot be distributed in static binary 2019-07-23 19:39:55 -07:00
Garrett D'Amore 77ab683d7d Improve 24-bit color support.
This expands support for 24-bit color for terminals that support the
ISO 8613-6:1994 escape sequences (same as xterm), allowing this support
to be enabled by setting % COLORTERM to "truecolor" (or 24bit or 24-bit),
or by setting TCELL_TRUECOLOR to "on", or by setting $TERM a value that
ends in the word "-truecolor".

As this is handled by the runtime now, we no longer need to create magical
database entries for -truecolor options.

A colors.go demo is provided to show off 24-bit color support.
2019-03-18 22:47:05 -07:00
Thomas Wouters 5ddf16a669 Allow octal and hexadecimal conversion to int
Auto detect the base as implied by `0` or `0x` prefixes.

Fixes #212
2018-04-23 06:10:09 -07:00
Garrett D'Amore 2f258105ca fixes #197 Problem on case insensitive filesystem
This changes the database to use sha1 based file names.  Its not
beautiful, but this is the BS we have to do to cope with the garbage
that is case insensitive filesystems.

Legacy databases are still honored, if you have them.
2018-04-16 09:37:43 -07:00
Graham Clark 99cec24157 Parse terminfo values containing numbers expressed in octal syntax.
I noticed that when running a tcell application under tmux using
TERM=screen-256color, some text rendered with style attributes
like bold and underline appeared preceded with "17". This seemed
to come from tcell sending "AttrOff"/sgr0, which in
term_screen_256xcolor.go looks like:

AttrOff:      "\x1b[m\x0017"

infocmp screen-256color expresses sgr0 like this:

sgr0=\E[m\017

This terminfo man page implies that \017 should be interpreted as
the octal representation of 15 decimal.

https://www.mkssoftware.com/docs/man5/terminfo.5.asp

The terminfo generator mkinfo.go parses the \0 as a zero, then
the following 17 as the digits 1 and 7. This patch modifies
mkinfo.go and results in the following instead

AttrOff:      "\x1b[m\x0f"

This seems to clear up the "17" problem for me. But I am not a
terminal expert by any means, so perhaps my interpretation is
incorrect!
2017-12-17 15:52:28 -08:00
Garrett D'Amore c0b0191744 Fix database for case insensitive file systems and truecolor. 2017-11-24 14:14:35 -08:00
Garrett D'Amore 8f08469772 fixes #167 Break up the database
This completely restructures the database of terminal types, putting
each terminal in its own file.  We also compress the database files,
and use infocmp instead of trying to use the C level API.

The mkdatabase script will rebuild the entire database from the terminfo
files on the system.  Individual entries can also be built by simply running
the mkinfo program with the terminal type.
2017-11-24 13:13:06 -08:00