Commit Graph

80 Commits

Author SHA1 Message Date
c147929f16 Add color aliases 2021-05-12 23:44:11 +02:00
6549436356 Fix line break regression
In commit d1d94cd, we accidentally introduced a regression
since conhost requires all line breaks to be `\r\n`.
2021-05-10 17:42:49 -04:00
d1d94cdebe Add Length and Lines properties to Paragraph
* Adds Length and Lines to `Paragraph`, `Markup` and `Text`.
* Do not use Environment.NewLine
2021-05-03 17:24:44 +02:00
cba02070f9 Add method to get VT/ANSI codes for renderables 2021-04-23 13:09:44 -04:00
3463dde543 Add method to write VT/ANSI control codes
Adds a new extension method IAnsiConsole.WriteAnsi that writes
VT/ANSI control codes to the console. If VT/ANSI control codes are
not supported, nothing will be written.
2021-04-22 22:16:10 -04:00
3e2eea730b Add output abstraction and reorganize profile
* Moves ColorSystem from Profile to Capabilities
* Renames Tty to IsTerminal
* Adds IAnsiConsoleOutput to make output more flexible

Closes #343
Closes #359
Closes #369
2021-04-13 21:39:54 -04:00
ca036f6543 Add demo example 2021-04-07 20:32:07 -04:00
36ec3d1fd3 Adds rune width caching for cell length calculations 2021-04-07 23:59:23 +02:00
fe5096dceb Fixes color system detection bug
If an application runs on Windows 10.0.15063 or above, on a
runtime prior to net5.0, the color system detection will fail
and fall back to 8-bit color support.

The reason for this is because the behavior of
Environment.OSVersion.Version differs between runtimes. Unless you're
running on net5.0, both the major and build version components will
not reflect those in the actual Windows version.
2021-04-07 11:15:45 -04:00
39b59c8d4a Cleanup AnsiSequences.cs
1. Update CSI constant to include the [ character.
See ECMA-48 Section 8.3.16
https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf

2. Use string interpolation, because it's easier to read
(and internally uses a StringBuilder)

3. Add ESC constant, because the AnsiBuilder needs it to create links.

4. Remove unused SGR overload.
2021-04-06 22:51:42 +02:00
be45a0ff4e Fix AnsiConsoleBackend.Clear
1. Add an ED3 command to clear the scroll buffer.

This command is not in the original ANSI terminal control sequences but
was added later to XTerm to account for the fact that most modern
terminals have a scroll-buffer.

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-J.1C8A

This command is now awailable in basically
all terminals with scroll-buffers

2. Change CUP coordinates to 1, 1

The coordinates 0, 0 also worked, but strictly speaking they are outside
the available screen area and are capped to 1, 1 anyways.

This commit fixes #337
2021-04-06 22:42:03 +02:00
759b16aed9 Fix OS version detection 2021-04-04 09:28:20 -04:00
6f16081f42 Add support for indeterminate progress
This commit also changes the behavior of ProgressContext.IsFinished.
Only tasks that have been started will be taken into consideration,
and not indeterminate tasks.

Closes #329
Closes #331
2021-04-03 09:42:49 -04:00
9204671b27 Uses Environment.TickCount for seed instead of DateTime.Now 2021-04-02 18:52:18 +02:00
c765bbd0dd Uses OSVersion instead of RegEx to detect Windows Build info
Perf improvement.
2021-04-02 18:51:30 +02:00
1ed7e65fcb Make VT-100 sequences easier to understand 2021-03-28 12:51:19 -04:00
20650f1e7e Change IAnsiConsole to render IRenderable
This makes it possible for encoders to output better representation
of the actual objects instead of working with chopped up segments.

* IAnsiConsole.Write now takes an IRenderable instead of segments
* Calculating cell width does no longer require a render context
* Removed RenderContext.LegacyConsole
* Removed RenderContext.Encoding
* Added Capabilities.Unicode
2021-03-28 09:06:06 -04:00
9c46c21e27 Fix argument order
Closes #319
2021-03-24 18:58:17 -04:00
7f6f2437b1 Add support for exclusive mode 2021-03-15 13:14:40 -04:00
08b65cfa47 Fix Windows ANSI support detection with redirected stderr 2021-03-14 23:41:07 +01:00
bff3438a5a using loop instead of linq
In both of these loops context is captured preventing caching of the lambda. this results in a pretty significant amount of allocations especially with progress bars that constantly are remeasuring
2021-03-01 08:22:45 +01:00
b64e016e8c Add breakdown chart support
This also cleans up the bar chart code slightly and fixes
some minor bugs that were detected in related code.

Closes #244
2021-02-01 01:03:39 +01:00
58400fe74e Fix code generation
Previous changes introduced some bugs to the
code generation scripts and templates, which
now have been fixed.
2021-01-29 21:46:08 +01:00
31a5e17a45 Remove InteractivityDetector 2021-01-19 18:12:15 +01:00
a23bec4082 Add profile support
Closes #231
2021-01-19 17:53:03 +01:00
07db28bb6f Add enhancements to progress widget
* Adds TransferSpeedColumn
* Adds DownloadedColumn
* Adds ElapsedTimeColumn
* Minor enhancements to existing columns
2021-01-12 14:10:07 +01:00
0e0f4b4220 Add interactive prompts for selecting values
* Adds SelectionPrompt
* Adds MultiSelectionPrompt

Closes #210
2021-01-09 09:37:28 +01:00
9ad5f2daeb Fix console detection for Cygwin/WSL-Shell on Windows 2021-01-04 18:24:56 +01:00
87e6b42409 Add tree example 2021-01-03 23:28:55 +01:00
b136d0299b Add tree widget 2021-01-02 10:01:16 +01:00
e71db7f78c fix some nullability issues 2020-12-31 11:09:03 +01:00
041aea2ae5 spelling 2020-12-26 18:16:41 +01:00
1cf30f62fc Add autocomplete for text prompt
Closes #166
2020-12-22 11:31:22 +01:00
6932c95731 Fix bug when splitting text containing CJK chars
In Segment.Split, we didn't take cell width into account
when calculating the offset, which resulted in some "fun" bugs.
I've added a new overload for Segment.Split and obsoleted the old one.

Closes #150
2020-12-17 00:02:00 +01:00
ae32785f21 Add progress task list support 2020-12-04 07:29:48 +01:00
4f6eca4fcb Fix rendering of exceptions with generic params
Closes #145
2020-11-24 22:16:17 +01:00
a59e0dcb21 Add FIGlet text support
Closes #97
2020-11-22 03:09:42 +01:00
0d209d8f18 Add text prompt support 2020-11-19 12:24:04 +01:00
380c6aca45 Add net5.0 target framework 2020-11-11 15:28:32 +01:00
a1d11e9d0c Add support for moving the cursor 2020-10-28 18:57:08 +01:00
e7f497050c Add row and column accessors for tables and grids 2020-10-26 18:15:27 +01:00
c9c0ad733f Fix rendering bug when splitting lines
The bug might occur if there are wide characters such as emojis
at the end of a line. The SplitLines method mixed cell width
and text length, which might give incorrect results. This commit
makes sure that comparison and calculation is done using cell width
where it's appropriate.
2020-10-24 01:45:41 +02:00
9afc1ea721 Add support for aligning tables 2020-10-21 18:15:51 +02:00
1410cba6c5 Add Markdown.Escape method 2020-10-20 01:09:26 +02:00
cb2924a609 Add table heading and footnote support
Closes #116
2020-10-19 15:46:57 +02:00
3f2ca49071 Add calendar control
Closes #101
2020-10-16 23:02:53 +02:00
68e92f3365 Add various exception improvements 2020-10-07 11:57:28 +02:00
3c3afe7439 Add support for rendering exceptions 2020-10-05 07:03:02 +02:00
b1db8a9403 Clean up border code
Removed caching that really didn't do anything anymore.
2020-10-01 23:05:02 +02:00
93ec7401c8 Add support for markdown tables
Closes #85

* Split Border into BoxBorder and TableBorder
* Change how different table parts are composed
* Add markdown table border
2020-10-01 14:43:08 +02:00