Kaushal Modi
4c2e712056
Support setting foreground/background colors to terminal defaults ( #8073 )
...
* Support setting foreground/background colors to terminal defaults
Adds fgDefault to ForegroundColor and bgDefault to BackgroundColor
enums.
For Windows console, the default foreground color is assumed to be
white, and the default background color black.
* Add default fg/bg color caching for Windows Console
2018-06-24 03:53:20 -04:00
Kaushal Modi
abbf9ba9f7
Convert styledWriteLine and styledEcho to templates
...
This also fixes a bug in the styledWriteLine behavior where the background color
leaked onto the next newline if that command did not end with resetStyle.
Now it is not necessary to end styledWriteLine calls that set BackgroundColor to
end in resetStyle.
2018-06-18 09:09:23 -04:00
Kaushal Modi
3b5b3deecd
Add styledWrite macro
...
Also:
- Move the tests block to the end of the file
- Fix the older tests
- Add tests for existing styledEcho
- Add new tests for styledWrite
Fixes https://github.com/nim-lang/Nim/issues/8046 .
2018-06-18 09:09:23 -04:00
Kaushal Modi
4616b28c7b
Add support for italic and strikethrough ANSI escape codes ( #8048 )
...
\e[3m -> italic
\e[9m -> strikethrough
On terminals not supporting italic text, the text is shown in reverse instead,
and on terminals not supporting strikethrough text, the text is shown as is.
2018-06-17 12:37:41 -04:00
Zahary Karadjov
6758fbd06e
Export an 'escapeXml' proc from xmldom
...
The interface is similar to escapeJson
2018-05-07 09:37:49 +02:00
Zahary Karadjov
5623007126
Fix the compilation of terminal.nim on Windows
2018-05-07 09:37:49 +02:00
Zahary Karadjov
4409c82228
The terminal module now exports additional procs for generating ANSI color
...
codes as strings.
2018-05-07 09:37:49 +02:00
Florent
d3ad467022
Fixes #7764 ( #7767 )
...
* Fixes #7764
* Change KEY_RECORD_EVENT filter
* Update terminal.nim
* Revert changes and modify readPasswordFromStdIn
2018-05-06 10:56:40 +02:00
WhiteDuke
e237428d42
Fix bright option ( #7622 )
...
Setting the option to true, then to false would not turn off bright attribute.
2018-04-18 23:29:10 +02:00
Vindaar
a897371797
move readPasswordFromStdin from rdstdin to terminal ( #7266 )
2018-02-27 17:49:35 +01:00
Araq
7740b12f21
revert commit 6cf8a72d49; Windows fixes getch bug
2018-02-27 17:47:19 +01:00
antizealot1337
6f0bb6e1f5
Fix style string formatting for cursorBackward and cursorForward ( #7243 )
2018-02-22 10:01:26 +01:00
Andreas Rumpf
fea66497b4
terminal.nim: code cleanup
2018-01-18 19:34:46 +01:00
Dmitry Atamanov
7ce38122e8
Support truecolor for the terminal stdlib module ( #6936 )
2018-01-18 18:48:59 +01:00
Dmitry Atamanov
b6b99da08f
Windows: fix a eraseLine bug ( #7044 )
2018-01-09 15:48:27 +01:00
Dmitry Atamanov
6cf8a72d49
Windows: fixes getch bug; fixes #6966 ( #7031 )
2018-01-05 17:32:05 +01:00
Yuriy Glukhov
e49f18801c
Fixed compilation error ( #6979 )
2017-12-27 17:35:57 +01:00
skilchen
822da4b213
fix #6931 terminal.eraseline() gives OverflowError on Windows ( #6933 )
2017-12-17 10:57:45 +01:00
Arne Döring
000b8afd26
Remove expr/stmt ( #5857 )
2017-07-25 09:28:23 +02:00
Fabian Keller
d1d32f657a
tiny docstring fix; fixes #5483 ( #5484 )
2017-03-05 10:44:25 +01:00
Araq
e236039d10
make tests on Windows green under --pedantic
2017-02-02 21:12:36 +01:00
John Novak
3fcb8a3246
Add terminalHeight, terminalHeightIoctl & terminalSize
2016-11-30 21:29:35 +10:00
Andreas Rumpf
ab43ad13dc
Merge pull request #5058 from johnnovak/terminal-win-fix
...
Fix setStyle for Windows
2016-11-29 01:57:14 +01:00
John Novak
88e01ffd92
Add hideCursor & showCursor
2016-11-26 21:08:01 +10:00
John Novak
64dd3eb9c1
Fix setStyle for Windows
...
* setStyle did not take the current color flags into account on Windows, this
is fixed now
* refactoring to get rid of magic constants
2016-11-26 16:36:08 +10:00
Charles Blake
e4ddcd836c
Use new name for call to low-level terminalWidth.
2016-09-01 14:44:33 -04:00
Charles Blake
d65589fe27
Make Windows part match Unix part more closely per Araq request.
2016-09-01 08:49:07 -04:00
Charles Blake
8df2078f08
Change type name to be more NEP-1-ish as per Araq request.
2016-09-01 08:33:39 -04:00
Charles Blake
5db1de87b1
Convert TaintedString to string.
2016-09-01 08:16:28 -04:00
Charles Blake
7b73a94afc
Oops - L_ctermid must be a global var to compile.
2016-09-01 07:54:17 -04:00
Charles Blake
19f83ccd0b
Add terminal.terminalWidth and supporting types/calls.
2016-09-01 07:34:42 -04:00
Andreas Rumpf
0834cd63d9
prepare Nim codebase for upcoming parser changes
2016-07-15 12:56:03 +02:00
miere43
7fc9585f7b
getch() asserts to doAsserts
2016-06-26 17:46:43 +03:00
miere43
57bd50a916
Removed INPUT_KEY_RECORD
2016-06-26 16:01:37 +03:00
miere43
dd7a24d8cc
Implemented terminal.getch() for Windows
2016-06-23 23:22:38 +03:00
Araq
3ccd5ca64b
make terminal.nim work with --app:gui
2015-10-19 16:09:35 +02:00
Adam Strzelecki
2bc6acc808
terminal: Support both styled stdout and stderr
...
This is important if we want to write styled diagnostics to stderr, eg. some
tool outputting results to stdout, but writing styled error messages to stderr.
Previously this module was assuming we are writing only to stdout. Now all
module procs take file handle as first argument. Wrappers assuming stdout are
provided for backwards compatibility.
The new terminal.styledWriteLine(f, args) is provided and documented as
counterpart for unstyled plain writeLine(f, args).
2015-10-16 20:55:17 +02:00
Adam Strzelecki
9ef50717fa
terminal: Remove superflous hStdout = conHandle
...
Use just hStdout on Windows to keep handle to process stdout.
2015-10-16 20:55:17 +02:00
patrick dw
15e7fe787a
renamed writeln to writeLine in lib
2015-06-19 01:02:22 -05:00
Adam Strzelecki
1057770ce5
colors: Introduce resetStyle enum & use templates
...
1. Introduce TerminalCmd enum and resetStyle that can be issued to issue
resetAttributes within styledEcho arguments.
2. Use templates to resolve styledEcho arguments for performance reasons.
3. Try to avoid calling trailing write "\n" and reset attributes where possible.
2015-06-15 11:26:53 +02:00
Araq
d4610d7716
terminal doesn't use enormous windows module anymore
2015-06-10 11:32:10 +02:00
pdw
d18e18060e
lib/pure/p-t - Dropped 'T' from types
2015-06-04 13:18:36 +02:00
Araq
3c13508b25
terminal: doc improvments
2015-05-28 12:51:17 +02:00
def
e5a186a419
Fix Termios wrapper
2015-04-24 19:41:12 +02:00
Oleh Prypin
32109a7867
Don't run non-test code when defined(testing)
2015-04-21 14:37:29 +03:00
Araq
419199bf9a
don't use conio.h on windows ( #2137 )
2015-03-08 14:45:06 +01:00
def
8640efcd40
Document terminal.getch
2015-02-04 14:10:58 +01:00
def
f3124e6de4
Add terminal.getch to get a single character
2015-02-03 17:27:59 +01:00
Varriount
41d11e0def
Fix #1906
2015-01-22 18:34:33 -05:00
Araq
28c3de7d3e
updated terminal.nim
2014-08-29 01:02:04 +02:00