Commit Graph

93 Commits

Author SHA1 Message Date
konsumlamm
9819fb21d8 Use .. warning:: (#17320) 2021-03-10 10:39:23 -08:00
Clyybber
507873be25 Use readable escape sequences (#17241) 2021-03-03 07:15:07 +01:00
flywind
70ec17eede use single backtick (#17133) 2021-02-21 00:27:39 -08:00
Timothee Cour
31bb67a309 add -d:nimStrictMode in CI to keep code from regressing; fixes ConvFromXtoItselfNotNeeded, UnusedImport notes (#16764) 2021-02-17 19:30:09 +01:00
flywind
f140c92409 fix some warnings (#16952) 2021-02-08 13:50:15 +01:00
Timothee Cour
18b983d7e3 addQuitProc => addExitProc (#16765) 2021-01-22 19:51:11 +01:00
Juan Carlos
78a99587a4 Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
2021-01-15 18:56:38 -08:00
Luca Guzzon
49f68122e6 Console apps in Windows can raise OSError (#15874)
Console apps in Windows implementation can raise OSError so I've fixed it, see below some examples for reference:
- c07807bedf/lib/pure/terminal.nim (L170)
- c07807bedf/lib/pure/terminal.nim (L178)
- c07807bedf/lib/pure/terminal.nim (L191-L192)
- c07807bedf/lib/pure/terminal.nim (L196-L197)
- ...
2020-11-08 11:51:40 +08:00
alaviss
d1af9587b8 terminal: fix fgColor/bgColor commands [backport] (#15554)
Since #8296, fgSetColor is no longer a global. These commands were
probably left out from the change as an oversight, so some tests have
been added to make sure this won't happen again.
2020-10-13 17:39:32 +01:00
Araq
40969296e9 fixes #15207 [backport:1.2] 2020-08-26 15:27:15 +02:00
flywind
9ec9a31f46 Fix #12759 (#14967)
* add testcase for #5926

* fix #12759
2020-07-12 03:31:03 -04:00
Andrey Makarov
26074f594d nimgrep improvements (#12779)
* fix sticky colors in styledWrite

* nimgrep: context printing, colorthemes and other

* add context printing (lines after and before a match)
* nimgrep: add exclude/include options
* nimgrep: improve error printing & symlink handling
* nimgrep: rename dangerous `-r` argument
* add a `--newLine` style option for starting matching/context
  lines from a new line
* add color themes: 3 new themes besides default `simple`
* enable printing of multi-line matches with line numbers
* proper display of replace when there was another match replaced at
  the same line / context block
* improve cmdline arguments error reporting
2019-12-05 14:42:20 +01:00
narimiran
5732bb41ef [backport] run nimpretty on the remaining files 2019-09-30 13:58:17 +02:00
Araq
07d465ca42 [refactoring] remove unused imports in the compiler and in some stdlib modules 2019-07-18 00:36:03 +02:00
Araq
87a2ced1ba there is only one style -- my style 2019-07-10 19:17:06 +02:00
Araq
c94647aeca styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error 2019-07-10 12:42:41 +02:00
Araq
3ceb258ebf fixes #11005 2019-04-12 13:28:13 +02:00
Araq
27e366eaec fixes #8294 [backport] 2019-01-15 22:47:21 +01:00
Araq
3f6168b337 removes deprecated T/P types 2018-11-16 13:27:56 +01:00
Vindaar
82a1576263 fix #9394 by replacing fmt with strutils.% (#9417)
* fix #9394 by replacing `fmt` with normal string append

Until issue #7632 is fixed, use string append.

* use `strutils.%` instead of normal string add
2018-10-18 14:47:47 +02:00
John Novak
692d1da95d Fix setCursorPos and setCursorXPos on POSIX (#8310) 2018-07-17 11:35:26 +02:00
Eugene Kabanov
3fec2ba5e5 Fix terminal.nim to be GCSAFE. (#8296)
* Also fix deprecated callsite().
2018-07-12 18:06:15 +02:00
Kaushal Modi
1102f9aaf1 Make the Style enum a proper Ordinal (no holes) (#8282)
The Style enum needs to be an Ordinal so that it can be used in sets.
2018-07-12 11:30:51 +02:00
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 6cf8a72d498f5cb8a532c2ff3259bc7aecf474ef; 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