Commit Graph

43 Commits

Author SHA1 Message Date
Garrett D'Amore 80a58b9089 fixes #462 Console resizing
This supports both terminfo (Linux, macOS) terminals, and
the legacy Windows console.  Perversely, the "modern" Windows
terminal doesn't support application initiated resizing yet.
2022-04-23 09:50:07 -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
eNV25 b60a903b98
Add Screen.ChannelEvents v2 (#465) 2021-06-11 19:43:12 -07:00
Garrett D'Amore 7a0b45cce0 fixes #422 RFE: Handling events in batches 2021-05-16 09:21:17 -07:00
Garrett D'Amore 0bfa151864 fixes #460 Possible race condition between Fini and PollEvent 2021-05-16 09:04:18 -07:00
Garrett D'Amore 0c349a85f4 Remove stale (unused) code in Windows finish. 2021-04-18 12:05:27 -07:00
Garrett D'Amore fb06997fe2 fixes #445 Prompt Cursor Lost after Suspend v2.2.0 Windows PowerShell 2021-04-18 12:04:21 -07:00
bobo liu e37d20eeec fixes PollEvent() hung after Fini() on windows 2021-04-18 11:31:00 -07:00
Garrett D'Amore 16556370d7 Support for new Suspend and Resume API.
fixes #194 Starting multiple screen sessions (lost key event)

You can test this by using the mouse demo, which now supports pressing
CTRL-Z.  This does not actually suspend the demo, but starts a subshell
which takes over.  After the subshell is exited, the demo takes control
of the screen back.  This can be done multiple times, and it is possible
to start multiple "nested" iterations of the demo this way.
2021-02-20 13:20:58 -08: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
Garrett D'Amore 7d87d8188c fixes #406 Windows 7 terminal - screen is shifted up one row 2020-11-08 21:26:06 -08:00
Garrett D'Amore 197faf3eae fixes #120 Support for bracketed paste mode
This adds Bracketed Paste support for terminals that have mouse
support and support it.  The bracketing events are EventPaste,
with methods to note Start() or End() of the paste.  Content
comes in as normal rune events.  Programs must opt-in to this by
calling screen.EnablePaste().
2020-10-15 23:13:03 -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 5216188a4f fixes #324 Fini() is not idempotent 2020-08-30 19:00:54 -07:00
Garrett D'Amore 23606a43e2 fixes #319 Pasting on windows still does a maximum of 10 characters
The Windows input scanner does not hold the screen lock, so we can
safely just block if we need to, so we use PostEventWait().
2020-08-30 03:03:47 -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 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
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
Graham Clark 6d0b0fa74e On windows, don't change cursor position if about to hide cursor.
A gowid user reported that mouse movement in their gowid(tcell) application
was causing the console cursor to flicker on windows, jumping from the current
position in the console to the top left corner, and back again. In part, this
is an artifact of the way I render a gowid "canvas" - calling HideCursor()
unilaterally, then calling ShowCursor(x, y) if the canvas contains a logical
cursor that is within bounds. Because currently every mouse event causes a
gowid application redraw, on windows the effect is to cause the cursor to jump
to the top left briefly, disappear, then reappear in the previous
position. You can see it most easily by moving the mouse rapidly left and
right.

An upstream fix is for me to only call HideCursor() if I know I'm not going to
call ShowCursor(x, y). But the flicker can also be eliminated by removing the
call to setCursorPos(0, 0) in console_win.go before hiding the cursor. The
single call to showCursor() in console_win.go is preceded by setting cursor
coordinates explicitly, so I don't think anything depends on the assumption
that a hidden cursor has been set to position (0, 0) first.
2019-06-11 17:21:45 -07:00
Garrett D'Amore 48f88019c3 fixes #243 Ordering of SetConsoleWindowInfo and SetConsoleScreenBufferSize 2019-03-19 00:22:32 -07:00
otani_koji f0cffc65c6 fixes #250 Some characters disappear on Windows 2019-03-18 23:57:44 -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
Xurane 91a5452278 disable quick edit mode on EnableMouse() in win10 2018-04-23 06:06:46 -07:00
Joe Grasse bac54371ba convert shift+tab to backtab 2018-04-18 13:51:55 -07:00
Michael Smith 0a0db94084 Fix cScreen.Fini() race condition (#158) (#159)
* Fix cScreen.Fini() race condition

Closes gdamore/tcell#158

* Tidy up Windows magic, and fix event ordering

* Move a couple of magic values into constants
* Add more explanatory comments
* Fix ordering WaitForMultipleObjects to give cancellation priority
* Also correct some indentation and minor formatting stuff.

* Use `chan struct{}` for `scandone` to not deadlock
2017-09-14 23:17:52 -07:00
Garrett D'Amore c52de15673 fixes #119 Restore Windows terminal colors 2016-10-19 14:21:13 -07: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 cf91b3e205 fixes #108 Space is Key() and not Rune() ? 2016-05-18 20:10:04 -07:00
Garrett D'Amore 5dc5326c0e fixes #44 Expose some capability info 2016-01-19 15:51:33 -08:00
Garrett D'Amore f763a5b1b7 fixes #75 Add goreport and fix related issues (a couple more) 2015-11-04 17:29:11 -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 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 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 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 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 061768321e fixes #20 Wide characters & combining characters busted
fixes #21 Want unicode test program
fixes #15 Add ACS drawing support
2015-10-04 19:53:38 -07:00
Garrett D'Amore 9a601da6e4 fixes #12 Windows reverse video broken 2015-10-03 11:51:57 -07:00
Garrett D'Amore feab7e00ed Add additional key codes 2015-10-03 11:29:55 -07:00
Garrett D'Amore 434fc57169 fixes #10 Eliminate separate buffered implementation
fixes #9 Various API enhancements
fixes #8 Mouse demo improvements
fixes #7 Add support for handling $<delay> delays
fixes #6 mkinfo doesn't honor terminfo LINES and COLUMNS
fixes #5 Add better mouse tracking
fixes #3 Windows performance improvements
2015-10-02 21:49:13 -07:00
Garrett D'Amore 385072b4a8 fixes #1 Add Windows support. 2015-09-28 23:42:13 -07:00
Garrett D'Amore b4ae936d42 Initial import of Tcell. 2015-09-26 23:37:54 -07:00