diff options
Diffstat (limited to 'lib/pure/terminal.nim')
-rw-r--r-- | lib/pure/terminal.nim | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/pure/terminal.nim b/lib/pure/terminal.nim index 87c663c3d..871ac5d39 100644 --- a/lib/pure/terminal.nim +++ b/lib/pure/terminal.nim @@ -578,7 +578,7 @@ template styledEchoProcessArg(f: File, cmd: TerminalCmd) = when cmd == resetStyle: resetAttributes(f) -macro styledWriteLine*(f: File, m: varargs[expr]): stmt = +macro styledWriteLine*(f: File, m: varargs[typed]): untyped = ## Similar to ``writeLine``, but treating terminal style arguments specially. ## When some argument is ``Style``, ``set[Style]``, ``ForegroundColor``, ## ``BackgroundColor`` or ``TerminalCmd`` then it is not sent directly to @@ -614,16 +614,13 @@ macro styledWriteLine*(f: File, m: varargs[expr]): stmt = result.add(newCall(bindSym"write", f, newStrLitNode("\n"))) if reset: result.add(newCall(bindSym"resetAttributes", f)) -macro callStyledEcho(args: varargs[expr]): stmt = +macro styledEcho*(args: varargs[untyped]): untyped = + ## Echoes styles arguments to stdout using ``styledWriteLine``. result = newCall(bindSym"styledWriteLine") result.add(bindSym"stdout") - for arg in children(args[0][1]): + for arg in children(args): result.add(arg) -template styledEcho*(args: varargs[expr]): expr = - ## Echoes styles arguments to stdout using ``styledWriteLine``. - callStyledEcho(args) - proc getch*(): char = ## Read a single character from the terminal, blocking until it is entered. ## The character is not printed to the terminal. |