about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-05-19 01:50:17 +0200
committerbptato <nincsnevem662@gmail.com>2023-05-19 01:50:17 +0200
commit26e8968a6499742cf37e00292a7d1c8ed620cad5 (patch)
treea3922f02f09b5c025dddcfe0e7a3a719c47ba4da /src/config
parentdac6a09c14b258ed725dcb265305a6445edc02ad (diff)
downloadchawan-26e8968a6499742cf37e00292a7d1c8ed620cad5.tar.gz
Add display/output encoding
Some encodings are still missing
Diffstat (limited to 'src/config')
-rw-r--r--src/config/config.nim20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/config/config.nim b/src/config/config.nim
index e7bb0c63..45c177ad 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -67,6 +67,7 @@ type
     wrap*: bool
 
   EncodingConfig = object
+    display_charset*: Option[Charset]
     document_charset*: seq[Charset]
 
   ExternalConfig = object
@@ -292,7 +293,6 @@ proc parseConfigValue(x: var Option[ColorMode], v: TomlValue, k: string)
 proc parseConfigValue(x: var Option[FormatMode], v: TomlValue, k: string)
 proc parseConfigValue(x: var FormatMode, v: TomlValue, k: string)
 proc parseConfigValue(x: var RGBAColor, v: TomlValue, k: string)
-proc parseConfigValue(x: var Option[bool], v: TomlValue, k: string)
 proc parseConfigValue[T](x: var Option[T], v: TomlValue, k: string)
 proc parseConfigValue(x: var ActionMap, v: TomlValue, k: string)
 proc parseConfigValue(x: var CSSConfig, v: TomlValue, k: string)
@@ -413,24 +413,14 @@ proc parseConfigValue(x: var RGBAColor, v: TomlValue, k: string) =
         "' for key " & k)
   x = c.get
 
-proc parseConfigValue(x: var Option[bool], v: TomlValue, k: string) =
-  typeCheck(v, {VALUE_STRING, VALUE_BOOLEAN}, k)
-  if v.vt == VALUE_STRING:
-    if v.s == "auto":
-      x = none(bool)
-    else:
-      raise newException(ValueError, "invalid value '" & v.s &
-        "' for key " & k)
+proc parseConfigValue[T](x: var Option[T], v: TomlValue, k: string) =
+  if v.vt == VALUE_STRING and v.s == "auto":
+    x = none(T)
   else:
-    var y: bool
+    var y: T
     parseConfigValue(y, v, k)
     x = some(y)
 
-proc parseConfigValue[T](x: var Option[T], v: TomlValue, k: string) =
-  var y: T
-  parseConfigValue(y, v, k)
-  x = some(y)
-
 proc parseConfigValue(x: var ActionMap, v: TomlValue, k: string) =
   typeCheck(v, VALUE_TABLE, k)
   for kk, vv in v: