1
0
mirror of https://github.com/gdamore/tcell.git synced 2025-04-26 13:48:53 +08:00

206 Commits

Author SHA1 Message Date
Garrett D'Amore
cc28e81105 fixes #370 Retire some old terminals 2020-08-30 01:58:02 -07:00
Elliott Sales de Andrade
b0881963db Add missing entries to models.txt.
Otherwise, deleting all `term.go` and re-running `bash gen.sh` does
_not_ produce everything again.
2020-08-27 11:05:36 -07:00
qlcom
b055e05f63 README: Add aerc to Example 2020-08-27 11:04:25 -07:00
Hubert Hirtz
a6386839fd Add italic code to alacritty terminfo 2020-08-26 07:01:04 -07:00
Garrett D'Amore
5889c5f171 fixes #314 Implement setf & setb
This causes colors that are set that are low numbered to
be treated as themed colors -- basically honoring the palette
of the terminal.

The Style and Color implementations have changed quite a bit
to permit growth -- the colors are now 64-bits wide to permit
using the upper bits as flags, and to leave room for a future
alpha channel.

There is a new TrueColor() method on colors that obtains the
value as strict RGB value, and this will be used in lieu of
whatever terminal colors are provided -- giving the application
full control over the color space if they want, without
forcibly clobbering user preferences for terminals for the
vast majority of cases.

Indexed colors are created with the new PaletteColor API.
2020-08-25 22:26:48 -07:00
Garrett D'Amore
8a32d2b0c8 Version 2.0 work in progress. v2.0.0-dev 2020-08-25 16:20:58 -07:00
Garrett D'Amore
5bef26acc2 fixes #358 EventMouse button mapping 2020-08-25 15:39:20 -07:00
Garrett D'Amore
fcaa20f283 minor readme updates v1.4.0 2020-08-25 15:26:09 -07:00
Garrett D'Amore
0c473b86d8 fixes #187 24-bit color for Windows 10 console
This works well on the new Windows 10 Terminal, as well as recent
Windows 10 ConHost.  Support for this is automatically enabled if
we detect that the terminal supports ANSI escapes, except for
ConEmu, which has a fairly severe scrolling bug with truecolor.

To opt-in anyway, set TCELL_TRUECOLOR to "enable" in your environment.

To opt-out, set TCELL_TRUECOLOR to "disable" in your environment.
2020-08-25 08:10:11 -07:00
Davor Najev
776d98d385 Add tpong to examples list 2020-08-23 15:13:37 -07:00
codesoap
ad515f0702 Add "Hello, World!" demo 2020-08-23 10:07:39 -07:00
Trevor Slocum
79a04f1021 Add cbind to examples
Resolves #333.
2020-06-20 14:43:05 -07:00
Endre Simo
cb1e5d6fa6 Include ascii-fluid into examples list 2020-06-08 06:33:53 -07:00
Garrett D'Amore
4b435a5197 Revert "allocate buffer once, outside the key loop"
This reverts commit 1b5e88726b02c4d65b5a921ba06f016708ef0f9d.

Reuse of the buffer causes a subtle bug if the consumer
does not read from the slice fast enough.  This was a regression.
2020-06-07 13:38:21 -07:00
VÖRÖSKŐI András
b0084cc526 Remove SetCursor(0,0) from CellArea SetModel
Removing SetCursor makes it possible to add lines to the model on the fly,
while keeping the cursor in position.

Go also initializes them with 0, no need to set it manually.
2020-05-27 19:47:21 -07:00
milrope
0a41e34912 Add fzf to example 2020-05-27 19:46:30 -07:00
Jeff Warner
74eda0d093 Mark tui-go as deprecated
As mentioned at on its homepage, the project is no longer being maintained and has been archived
2020-05-27 19:45:07 -07:00
Joshua M. Clulow
157ccd71a2 fix build on illumos after Beep() API
The build for the "solaris" and "illumos" tags appears to have been
broken by commit 8ec73b6fa6c543d5d067722c0444b07f7607ba2f, which
introduced the Beep() API.  Restore functionality by using the same
implementation as every other UNIX family platform.
2020-05-27 19:43:05 -07:00
VÖRÖSKŐI András
e277d9c03b Fix TextArea SetContent method
SetContent should overwrite the model, not append to it.

Add a test to check model's width and height after SetContent calls.
2020-05-07 07:39:48 -07:00
VÖRÖSKŐI András
1f1f979c1b TextArea: use [][]rune instead of []string in linesModel
This way GetCell() will get full runes, not just bytes. Now accent characters will show properly

Adjust SetLines() and Init() to work on [][]rune instead of []string
2020-04-13 12:51:31 -07:00
Nojus Gudinavičius
8572f72a22 Add support for italics 2020-04-13 07:15:39 -07:00
Martin Angers
1b5e88726b allocate buffer once, outside the key loop 2020-04-13 07:13:55 -07:00
Ben Burwell
8ec73b6fa6 Implement Beep() API
Add a Beep() method to the Screen interface. On *nix systems, this
writes the bell character (0x07) to the tty. On Windows, we call the
MessageBeep syscall.

Fixes: #2
2020-03-15 10:36:32 -07:00
Anatoly Rugalev
96a065d8ff Fixed text incorrect width calculation for multiline strings 2020-03-15 10:34:41 -07:00
VÖRÖSKŐI András
b03a4607a4 Add GetModel() method to CellView
GetModel() returns CellView.model type CellModel
2020-02-28 11:53:41 -08:00
VÖRÖSKŐI András
66b1faf255 CeellView corsor remove
Do not store cursor info (cursorX, CursorY) in CellView, as it belongs to the model (CellModel)

Use GetCursor() to identify current cursor position from CellModel
2020-02-28 11:53:41 -08: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
bff4943f9a Provide a fallback terminal size if the OS returns (0,0)
Sometimes, the TIOCGWINSZ ioctl returns all zeroes (including columns,
rows) without an error. I found this when experimenting with the jexer
TUI toolkit for java e.g.

mvn dependency:get -Dartifact=com.gitlab.klamonte:jexer:0.3.2
jexer -jar ~/.m2/repository/com/gitlab/klamonte/jexer/0.3.2/jexer-0.3.2.jar

Once the demo starts, click the "Terminal" button, then type

stty size

it returns

0 0

My understanding is that this is normal, and happens until SIGWINCH is
received, or the size is set explicitly with TIOCSWINSZ.

My tcell application crashed under the jexer terminal because I didn't
anticipate a window size of (0,0).

If you run vim under the jexer terminal, it correctly sizes itself to
80x24. The shell's TERM variable is xterm, and infocmp xterm | grep cols
shows a default of 80 and a default of 24 for lines. The documentation
for vim explains how it computes the terminal size:

https://github.com/vim/vim/blob/master/runtime/doc/term.txt#L629

- an ioctl call (TIOCGSIZE or TIOCGWINSZ, depends on your system)
- the environment variables "LINES" and "COLUMNS"
- from the termcap entries "li" and "co"

This PR replicates that logic in the getWinSize() function. I think it
makes sense here because tScreen holds the TermInfo struct but the
tcell.Screen interface does not expose TermInfo to clients - of course
because the screen is abstracted to work on Windows too.
2020-01-14 19:03:18 -08:00
Graham Clark
0253335d5d Update terminfo DB to fix backspace issues
I have rerun gen.sh having pulled the latest tcell to include this PR:
https://github.com/gdamore/tcell/pull/325.

I am using Ubuntu 19.04 - running gen.sh changed more fields than just
those impacted by the above fix. I've removed those from this commit. (I
verified that gen.sh changed those fields I've removed without the fix
above, so it's not related). Based on TERMINALS.md, I suspect you
regenerate these typically on a Debian machine(?)
2020-01-14 19:01:46 -08:00
Garrett D'Amore
ef4e0a2e86 fixes #323 Missing termbox key binding 2020-01-13 21:31:55 -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
MichaelS11
d650ce5ff5 Added Go Tetris 2019-12-03 17:43:29 -08:00
Ben Hoyt
15a6351b65 Update runewidth to v0.0.7 to fix CP437 char width issues 2019-12-03 17:40:46 -08:00
Ben Hoyt
b6a97de0c1 Update go-colorful to v1.0.3 to avoid go-sqlmock dependency 2019-11-14 17:44:13 -08:00
Garrett D'Amore
aab872a249 Workflow for tcell Go 2019-11-14 17:43:26 -08:00
Garrett D'Amore
901f4de1e2
Insert GitHub and Tidelift sponsorship info. 2019-11-01 08:18:39 -07:00
Garrett D'Amore
3e3de19da0
Start with just Patreon for now. 2019-11-01 00:22:15 -07:00
Garrett D'Amore
e38693ffb0
Fixes to FUNDING.yml 2019-11-01 00:15:04 -07:00
Garrett D'Amore
9400b55510 Create FUNDING.yml 2019-11-01 00:09:54 -07:00
Garrett D'Amore
fc60a7c5fe
Add link to discord server (#310)
We're migrating to discord, because gitter usability has decreased to the point of being useless.

A few other minor cleanups.
2019-11-01 00:02:10 -07:00
Garrett D'Amore
4d152cc262 fixes #302 merge extended terminfo definitions into default
This makes the default build about 150k larger, but includes all
the good terminals needed to make most folks happy.  In addition,
it allows a build tag of tcell_minimal to suppress that.  Finally,
we do not include infocmp support on platforms unlikely to support
it, such as Windows, nacl, android, etc.
v1.3.0
2019-09-22 11:15:39 -07:00
Cole Helbling
ae1dc54d2c Add terminfo for Alacritty 2019-08-05 09:28:43 -07:00
Asger Hautop Drewsen
4e7865679e Add terminfo for kitty (#283) 2019-08-01 11:20:19 -07:00
Garrett D'Amore
fef653e8d0 Update README for new mkinfo 2019-07-29 22:47:04 -07:00
Garrett D'Amore
1922b3786e fixes #252 database cannot be distributed in static binary v1.2.0 2019-07-23 19:39:55 -07:00
Garrett D'Amore
84b54971b4 fixes #294 Baud rate should not matter 2019-07-23 19:03:31 -07:00
Garrett D'Amore
061f3f89b0 fixes #277 Build fails on mips architectures v1.1.4 2019-06-27 18:33:09 -07:00
Garrett D'Amore
30e78c7859 it is really illumos/solaris 2019-06-26 11:47:15 -07:00
Garrett D'Amore
4d4b990045 fixes #257 Broken illumos Support
This change has refactored the illumos layer to make use of the
golang.org/x/sys/unix package to achieve a clean cgo-free solution
for illumos and Solaris.

The approach here should be a template for other systems.  I've
also made some changes to the Linux port.
2019-06-26 11:31:59 -07:00
Garrett D'Amore
ca8fb5bcc9 fixes #279 process new terminal descriptions at application runtime
fixes #285 Loss of color/mangled formatting on GNU screen
fixes #93 use the terminfo database instead of the json database

This change falls back to using a dynamically generated terminal
description (using infocmp, which must be on the path) if the builtin
database doesn't have a suitable description.

For most users this should resolve the problem of unknown terminals.
v1.1.3
2019-06-12 23:38:18 -07:00