Commit Graph

47 Commits

Author SHA1 Message Date
Garrett D'Amore 78110e30f8 fixes #561 Add clipboard support.
This is not supported for Windows or WebAssembly yet.
It's possible for applications to post to the clipboard using
Screen.SetClipboard (any data), and they can retrieve the clipboard
(if permitted) using GetClipboard.  The terminal may well reject either
of these.

Retrieval will arrive as a new EventClipboard, if it can.  (There is
no good way to make this synchronous.)

This work was inspired by a PR submitted by Consolatis (#562), and
has some work based on it, but it was also substantially improved and
now includes both sides of the clipboard access pattern.
2024-03-10 14:05:48 -07:00
Garrett D'Amore c9ba0cf327 fixes #710 Add support for setting the window title 2024-03-09 10:05:58 -08:00
Garrett D'Amore 887cf2766e fixes #666 cursor color
This adds a new optional parameter to screen.SetCursorStyle,
which is a color.  The cursors demo is enhanced to show this.

This ability is supported on screen types, provided the underlying
terminal supports the capability.
2024-03-07 08:32:39 -08:00
Garrett D'Amore 9970579247 style test: better contrast colors 2024-03-05 01:00:52 -08:00
Garrett D'Amore 9bc5c636ae Underline API change.
The underline styles are mutually exclusive.  And let's simplify
passing the color with the underline style in a single function call.
2024-03-04 23:56:23 -08:00
Garrett D'Amore 826c271964 Colored underlines.
This supports UNIX and Windows.
2024-03-04 21:19:42 -08:00
Garrett D'Amore ef0ee53eee minor clean up for style demo 2024-03-03 19:06:42 -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 b02dac3826 fix stress demo (race on close) 2024-03-03 15:02:14 -08:00
Marcel Schramm 2c305c06d7 Add little stresser that just draws as much 'random' stuff as possible 2024-03-03 13:51:12 -08:00
Garrett D'Amore 92c4f488a6 mouse demo: fix crash when multiple buttons pressed together
If we cannot decode the buttons in a drag, we might try to use '*',
which would reuslt in a negative index in the theme table.  This
only affected the demo application itself.
2023-12-03 17:42:09 -08:00
Tim Culverhouse 83e6762660 demos: add sixel demo
Add a demo of sixel drawing
2023-08-15 06:57:42 -07:00
Garrett D'Amore 8b8ed1d164 go fmt compliance fixes 2023-08-14 18:36:19 -07:00
stk f028121cb8 Make focus reporting an opt-in feature, like mouse reporting 2023-08-14 17:07:05 -07:00
stk 85dc29bf8a Implement focus events 2023-08-14 17:07:05 -07:00
Garrett D'Amore 5db823e7a8 Better colors for mouse demo (brighter). 2023-02-20 20:51:25 -08:00
Garrett D'Amore 896efabe24 Better handling for monochrome.
We will automatically select an inverse video mode if we cannot
find any colors at all.  This should help some fallbacks.
2022-07-29 20:02:51 -07:00
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 22d7226321 Show modifiers with mouse buttons in demo. 2022-04-16 20:27:20 -07:00
Garrett D'Amore e7b14a71dc fixes #300 Implement terminal hyperlinks
fixes #526 tcell emits redundant attributes

This work is inspired by, and partly derived from, work submitted by
Simon Ser (@emersion).  However, we've modified the bottom half of
the terminfo parser to better support strings properly, and are using
proper terminfo syntax.

Instead of an attribute called Hyperlink, we have called it Url
for the sake of brevity.

While here we noticed and fixed bug #526, which could badly impact slow
terminals, or slow links. This likely makes things better for folks
coming over long distance SSH connections for example.

We've also provided OSC 8 handling for all terminals which appear to
support the mouse sequences; hopefully ones that don't handle this
sensibly will just ignore it.  (Limited testing seems to show this.)
2022-04-16 10:57:21 -07:00
Garrett D'Amore cb7cb02d04 Include some explanatory text for the cursor demo. 2022-04-16 10:57:21 -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 299cb413dc Add a sample style to hello world. 2021-04-18 12:26:17 -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 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 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. 2020-08-25 16:20:58 -07:00
codesoap ad515f0702 Add "Hello, World!" demo 2020-08-23 10:07:39 -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
Garrett D'Amore d195cc757c fixes #264 tcell breaks grapheme clusters 2019-03-18 23:41:32 -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
Garrett D'Amore 86147f14ef fixes #233 Want zero-width joiners support 2018-09-05 18:42:39 -04: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 c46d32264a fixes #70 Background(), Foreground(), and Decompose() don't pass RGB 2015-11-03 12:52:42 -08:00
Garrett D'Amore d1cdd81c57 fixes #60 demo's: boxes: character set not supported 2015-10-28 08:22: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 0768982260 fixes #42 Mouse.go has wrong comment 2015-10-09 16:55:15 -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 4a014d05f5 fixes #23 Fifo overfull hang 2015-10-05 01:27:55 -07:00
Garrett D'Amore dd7d40dd07 fixes #17 Support UTF-8 to 8-bit codes 2015-10-04 23:22:57 -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 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