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

57 Commits

Author SHA1 Message Date
Garrett D'Amore
5bef26acc2 fixes #358 EventMouse button mapping 2020-08-25 15:39:20 -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
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
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
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.
2019-09-22 11:15:39 -07: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
84b54971b4 fixes #294 Baud rate should not matter 2019-07-23 19:03:31 -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.
2019-06-12 23:38:18 -07:00
Graham Clark
12658f0d57 Another attempt to fix limited length of paste.
I humbly submit this patch as another attempt to address the issue that tcell
will only paste up to 11 characters at a time. The problem is caused by the
fact that events (key, mouse, etc) constructed from the stream of raw input
characters are sent to the consuming application over a length-10 channel via
screen.PostEvent() which, if the channel is full, will drop what can't be sent
immediately. If the input stream grows rapidly e.g. because the user pasted a
large section of text into the running tcell application, then more than 10
events will likely be built from the chunk of input read by scanInput().

A blocking channel send is not used (i.e. PostEventWait() instead of
PostEvent()) because the channel send is issued from a call stack in which the
screen struct's lock is held. If the receiving application is not consuming
events, then callers to other screen APIs will block waiting for the screen's
lock. If the receiving application needs to call another screen API before
reading from the channel, a deadlock may occur if that required screen API
tries to take the screen's lock.

This patch collects events extracted from the input stream into a slice while
the lock is held, then after releasing the screen lock, writes them in order
to the event channel with PostEventWait(). I chose the blocking API to ensure
events aren't dropped, since sending the events outside of the lock-held scope
should remove the risk of a deadlock (unless I've missed something important!)

This patch is similar in spirit to that submitted by @soyking:
9addd5bbe4.

I have not adjusted the windows cmd console screen because the paste problem
does not seem to be an issue in practice on that platform, at least according
to my testing.
2019-06-09 10:24:20 -07:00
gcla
ec71b09872 An attempt to speed up tcell screen rendering. (#247) 2019-03-19 00:31:05 -07:00
ia
de7e78efa4 all: gofmt
Run standard gofmt command on project root.

- go version go1.10.3 darwin/amd64

Signed-off-by: ia <isaac.ardis@gmail.com>
2018-06-23 12:52:09 -07:00
Tyler Sommer
aa381bce1b Fix data race in tScreen shutdown
Setting t.quit to nil while the mainLoop is running causes a
race condition when the Fini() method is called. This change
instead uses a select expression to avoid the nil check and set.
2018-03-20 19:13:36 -07:00
Tony Worm
535ff868b7 Fix panic when quit chan double closed
I've been experiencing  panics occasionally/randomly on this `close(t.quit)` for double closes.

The changes seem to fix some of the obscure panics.
2018-02-16 23:21:25 -08:00
Garrett D'Amore
061d51a604 fixes #169 data race between inputLoop and mainLoop 2017-11-24 15:55:02 -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
Garrett D'Amore
87c64c441a Post an error event on receiving an error from the input. 2017-09-25 07:14:38 -07:00
Garrett D'Amore
50f9ed7673 fixes #129 Very high IDLE_WAKE - Power consumption
fixes #164 KeyEscape does not work in Go 1.9 under Linux

This is a complete refactor of the input loop for UNIX systems.
We use a blocking reader on the TTY, and a separate select
loop for timers and other events.  This means that our idle
use should be low now.
2017-09-23 23:25:24 -07:00
Junegunn Choi
d4838882df
Fix display of 24-bit background with default foreground 2016-11-25 16:26:21 +09:00
Garrett D'Amore
91d5e748ae fixes #114 Add Fill() method View API
fixes #113 Create SimpleStyledTextBar
2016-05-23 14:55:11 -07:00
Garrett D'Amore
02686d5300 fixes #103 ShiftAlt + arrows and ShiftCtrl + arrows 2016-05-19 16:45:31 -07:00
Garrett D'Amore
2af553baed fixes #91 why add a CSI before each SGR attribute? 2016-05-19 11:35:33 -07:00
Garrett D'Amore
a04d3e916b fixes #104 Screen.ShowCursor() does not display cursor 2016-05-18 19:57:23 -07:00
Zachary Yedidia
f722733809 fixes #109 Support both meta and alt + arrow keys 2016-05-18 19:49:02 -07:00
Garrett D'Amore
9059a787e5 fixes #98 Deal with incorrect motion event reporting 2016-04-29 06:08:51 -07:00
Garrett D'Amore
9aae61f33a fixes #95 Detecting ctrl, shift, alt + arrow keys 2016-04-28 13:30:53 -07:00
Garrett D'Amore
e8222e0f89 fixes #88 Detecting meta/alt key events 2016-04-28 00:44:30 -07:00
Zachary Yedidia
0dd71be383 fixes #92 sgr mouse report off by one error 2016-04-20 07:37:07 -07:00
Garrett D'Amore
815826d8a7 fixes #87 keypad handling needs work 2016-03-23 13:15:58 -07:00
Garrett D'Amore
04e5e8c5bc fixes #85 Key press not registered (only key release) for some keys 2016-03-23 10:49:51 -07:00
Garrett D'Amore
5dc5326c0e fixes #44 Expose some capability info 2016-01-19 15:51:33 -08:00
Garrett D'Amore
46abb28d77 fixes #83 Data race while calling Screen.Fini 2015-12-15 12:55:04 -08:00
Garrett D'Amore
43f9cc0d07 fixes #75 Add goreport and fix related issues 2015-11-04 17:05:24 -08:00
Garrett D'Amore
33f5ff39fa fixes #43 Minimize use of CGO 2015-11-01 21:37:37 -08:00
Garrett D'Amore
ca965237d9 fixes #52 Begin integrating topsl components 2015-11-01 14:44:23 -08:00
Garrett D'Amore
e7d14c2863 fixes #62 windows console may have FIFO hang
fixes #63 Initial views API integration
2015-10-30 12:18:06 -07:00
Garrett D'Amore
f426ddb33c fixes #54 Want 24-bit color
fixes #59 terminfo handling not right for extended formats
2015-10-27 23:28:26 -07:00
Garrett D'Amore
3a37c6d89f fixes #58 Use color space to find best matching colors
fixes #57 Windows build broken by color renames
2015-10-27 16:42:22 -07:00
Garrett D'Amore
e90b190a07 fixes #56 Color space must increase
fixes #55 Color names are unfortunate
2015-10-27 14:29:32 -07:00
Garrett D'Amore
6939959660 fixes #50 Expose CanDisplay(rune) 2015-10-14 19:46:35 -07:00
Garrett D'Amore
5bef83acf3 fixes #45 Add fallback rune support 2015-10-14 19:09:00 -07:00
Garrett D'Amore
71eb31ce98 fixes #49 Emit "EnableACS" on legacy terminals 2015-10-14 14:36:23 -07:00
Garrett D'Amore
7322e40c26 fixes #37 Improve docs & fix golint
fixes #38 Broke wide characters in last update
fixes #39 Clean up logic for encodings, enhance fallback options
fixes #36 Support more mouse buttons on Windows.
2015-10-08 09:48:01 -07:00
Garrett D'Amore
02eef725e2 fixes #35 Inadequate buffering dirty/detection algorithm 2015-10-07 02:35:14 -07:00
Garrett D'Amore
eccaea0126 fixes #30 Resize needs to invalidate cells
fixes #29 ErrorEvent needs to implement error
2015-10-06 01:07:11 -07:00
Garrett D'Amore
118fce3ce9 fixes #28 Writes can occur after Fini 2015-10-06 00:14:18 -07:00
Garrett D'Amore
b19d7067f2 fixes #26 Improved docs desired 2015-10-05 15:46:51 -07:00
Garrett D'Amore
c2130fd973 fixes #25 Input of unusual characters not right in non-Unicode locales
fixes #24 Combining characters not rendered on GB18030
2015-10-05 14:30:36 -07:00
Garrett D'Amore
4a014d05f5 fixes #23 Fifo overfull hang 2015-10-05 01:27:55 -07:00
Garrett D'Amore
b8c3aaddbc fixes #22 Full width characters not displayed in GB18030 2015-10-05 00:10:17 -07:00