Merge branch 'devel' of github.com:nim-lang/Nim into devel

This commit is contained in:
Andreas Rumpf
2018-06-19 12:43:21 +02:00
2 changed files with 9 additions and 5 deletions

View File

@@ -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

View File

@@ -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")