about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-11-28 19:52:10 +0100
committerbptato <nincsnevem662@gmail.com>2022-11-28 23:00:06 +0100
commiteb2e57c97eb67eec19f068e294a8f6d1375c82f5 (patch)
tree87156c515f6ee9a63f58dc080184bd3127ce6836 /src/config
parent8af10b8b74fd29fe4c9debcd5cbecfaddf53a7b5 (diff)
downloadchawan-eb2e57c97eb67eec19f068e294a8f6d1375c82f5.tar.gz
Add textarea
Editing is implemented using an external editor (like vi).
Diffstat (limited to 'src/config')
-rw-r--r--src/config/bufferconfig.nim7
-rw-r--r--src/config/config.nim26
2 files changed, 26 insertions, 7 deletions
diff --git a/src/config/bufferconfig.nim b/src/config/bufferconfig.nim
deleted file mode 100644
index 78f3b87e..00000000
--- a/src/config/bufferconfig.nim
+++ /dev/null
@@ -1,7 +0,0 @@
-import config/config
-
-type BufferConfig* = object
-  userstyle*: string
-
-proc loadBufferConfig*(config: Config): BufferConfig =
-  result.userstyle = config.stylesheet
diff --git a/src/config/config.nim b/src/config/config.nim
index ff4f0b45..316e6d33 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -11,8 +11,11 @@ import utils/twtstr
 type
   ColorMode* = enum
     MONOCHROME, ANSI, EIGHT_BIT, TRUE_COLOR
+
   FormatMode* = set[FormatFlags]
+
   ActionMap = Table[string, string]
+
   Config* = ref ConfigObj
   ConfigObj* = object
     nmap*: ActionMap
@@ -26,6 +29,24 @@ type
     formatmode*: Option[FormatMode]
     altscreen*: Option[bool]
     mincontrast*: float
+    editor*: string
+    tmpdir*: string
+
+  BufferConfig* = object
+    userstyle*: string
+
+  ForkServerConfig* = object
+    tmpdir*: string
+    ambiguous_double*: bool
+
+func getForkServerConfig*(config: Config): ForkServerConfig =
+  return ForkServerConfig(
+    tmpdir: config.tmpdir,
+    ambiguous_double: config.ambiguous_double
+  )
+
+func getBufferConfig*(config: Config): BufferConfig =
+  result.userstyle = config.stylesheet
 
 func getRealKey(key: string): string =
   var realk: string
@@ -164,6 +185,11 @@ proc parseConfig(config: Config, dir: string, t: TomlValue) =
             config.mincontrast = float(v.i)
           else:
             config.mincontrast = float(v.f)
+    of "external":
+      for k, v in v:
+        case k
+        of "editor": config.editor = v.s
+        of "tmpdir": config.tmpdir = v.s
 
 proc parseConfig(config: Config, dir: string, stream: Stream) =
   config.parseConfig(dir, parseToml(stream))