about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-12-07 19:02:56 +0100
committerbptato <nincsnevem662@gmail.com>2022-12-07 19:02:56 +0100
commit31162225df672187e4b73423ac2f4bc25937fd3f (patch)
tree7c52d54677897b4eaa258592bfa96d3b7b303505 /src/config
parenteb61a176754a565a5c53562993897388fa2d260c (diff)
downloadchawan-31162225df672187e4b73423ac2f4bc25937fd3f.tar.gz
Add multiple text-decoration, overline emulation
Diffstat (limited to 'src/config')
-rw-r--r--src/config/config.nim29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/config/config.nim b/src/config/config.nim
index 941f8c54..19cf9a8a 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -37,12 +37,14 @@ type
     headless*: bool
     colormode*: Option[ColorMode]
     formatmode*: Option[FormatMode]
+    noformatmode*: FormatMode
     altscreen*: Option[bool]
     mincontrast*: float
     editor*: string
     tmpdir*: string
     siteconf: seq[StaticSiteConfig]
     forceclear*: bool
+    emulateoverline*: bool
 
   BufferConfig* = object
     userstyle*: string
@@ -170,6 +172,18 @@ proc parseConfig(config: Config, dir: string, t: TomlValue) =
         of "inline":
           config.stylesheet &= v.s
     of "display":
+      template get_format_mode(v: TomlValue): FormatMode =
+        var mode: FormatMode
+        for vv in v.a:
+          case vv.s
+          of "bold": mode.incl(FLAG_BOLD)
+          of "italic": mode.incl(FLAG_ITALIC)
+          of "underline": mode.incl(FLAG_UNDERLINE)
+          of "reverse": mode.incl(FLAG_REVERSE)
+          of "strike": mode.incl(FLAG_STRIKE)
+          of "overline": mode.incl(FLAG_OVERLINE)
+          of "blink": mode.incl(FLAG_BLINK)
+        mode
       for k, v in v:
         case k
         of "alt-screen":
@@ -188,17 +202,9 @@ proc parseConfig(config: Config, dir: string, t: TomlValue) =
           if v.vt == VALUE_STRING and v.s == "auto":
             config.formatmode = none(FormatMode)
           elif v.vt == VALUE_ARRAY:
-            var mode: FormatMode
-            for v in v.a:
-              case v.s
-              of "bold": mode.incl(FLAG_BOLD)
-              of "italic": mode.incl(FLAG_ITALIC)
-              of "underline": mode.incl(FLAG_UNDERLINE)
-              of "reverse": mode.incl(FLAG_REVERSE)
-              of "strike": mode.incl(FLAG_STRIKE)
-              of "overline": mode.incl(FLAG_OVERLINE)
-              of "blink": mode.incl(FLAG_BLINK)
-            config.formatmode = some(mode)
+            config.formatmode = some(get_format_mode v)
+        of "no-format-mode":
+          config.noformatmode = get_format_mode v
         of "highlight-color":
           config.hlcolor = parseRGBAColor(v.s).get
         of "double-width-ambiguous":
@@ -209,6 +215,7 @@ proc parseConfig(config: Config, dir: string, t: TomlValue) =
           else:
             config.mincontrast = float(v.f)
         of "force-clear": config.forceclear = v.b
+        of "emulate-overline": config.emulateoverline = v.b
     of "external":
       for k, v in v:
         case k