diff options
-rw-r--r-- | doc/tut1.rst | 5 | ||||
-rw-r--r-- | lib/pure/terminal.nim | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/doc/tut1.rst b/doc/tut1.rst index f2251c463..aa6114cf7 100644 --- a/doc/tut1.rst +++ b/doc/tut1.rst @@ -208,7 +208,8 @@ Note that declaring multiple variables with a single assignment which calls a procedure can have unexpected results: the compiler will *unroll* the assignments and end up calling the procedure several times. If the result of the procedure depends on side effects, your variables may end up having -different values! For safety use only constant values. +different values! For safety use side-effect free procedures if making multiple +assignments. Constants @@ -642,7 +643,7 @@ initialisation. Parameters ---------- -Parameters are constant in the procedure body. By default, their value cannot be +Parameters are immutable in the procedure body. By default, their value cannot be changed because this allows the compiler to implement parameter passing in the most efficient way. If a mutable variable is needed inside the procedure, it has to be declared with ``var`` in the procedure body. Shadowing the parameter name diff --git a/lib/pure/terminal.nim b/lib/pure/terminal.nim index fcca4d5d7..8ee95957d 100644 --- a/lib/pure/terminal.nim +++ b/lib/pure/terminal.nim @@ -467,16 +467,18 @@ proc resetAttributes*(f: File) = f.write(ansiResetCode) type - Style* = enum ## different styles for text output + Style* = enum ## different styles for text output styleBright = 1, ## bright text styleDim, ## dim text - styleUnknown, ## unknown + styleItalic, ## italic (or reverse on terminals not supporting) styleUnderscore = 4, ## underscored text styleBlink, ## blinking/bold text - styleReverse = 7, ## unknown + styleReverse = 7, ## reverse styleHidden ## hidden text + styleStrikethrough, ## strikethrough {.deprecated: [TStyle: Style].} +{.deprecated: [styleUnknown: styleItalic].} when not defined(windows): var @@ -843,6 +845,7 @@ when not defined(testing) and isMainModule: write(stdout, "never mind") stdout.eraseLine() stdout.styledWriteLine("styled text ", {styleBright, styleBlink, styleUnderscore}) + stdout.styledWriteLine("italic text ", {styleItalic}) stdout.setBackGroundColor(bgCyan, true) stdout.setForeGroundColor(fgBlue) stdout.writeLine("ordinary text") |