about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.nim2
-rw-r--r--src/server/forkserver.nim16
-rw-r--r--src/utils/strwidth.nim4
3 files changed, 6 insertions, 16 deletions
diff --git a/src/main.nim b/src/main.nim
index a5c7d3dc..f308e1ed 100644
--- a/src/main.nim
+++ b/src/main.nim
@@ -195,7 +195,7 @@ proc main() =
     if res.isNone:
       stderr.write("Error parsing commands: " & res.error)
       quit(1)
-  set_cjk_ambiguous(config.display.double_width_ambiguous)
+  isCJKAmbiguous = config.display.double_width_ambiguous
   if ctx.pages.len == 0 and stdin.isatty():
     if ctx.visual:
       ctx.pages.add(config.start.visual_home)
diff --git a/src/server/forkserver.nim b/src/server/forkserver.nim
index 5d466292..51c6a268 100644
--- a/src/server/forkserver.nim
+++ b/src/server/forkserver.nim
@@ -41,10 +41,6 @@ type
     sockDirFd: int
     sockDir: string
 
-  ForkServerConfig* = object
-    sockdir*: string
-    ambiguous_double*: bool
-
 proc forkLoader*(forkserver: ForkServer; config: LoaderConfig): int =
   forkserver.ostream.withPacketWriter w:
     w.swrite(fcForkLoader)
@@ -57,10 +53,8 @@ proc forkLoader*(forkserver: ForkServer; config: LoaderConfig): int =
 proc loadForkServerConfig*(forkserver: ForkServer; config: Config) =
   forkserver.ostream.withPacketWriter w:
     w.swrite(fcLoadConfig)
-    w.swrite(ForkServerConfig(
-      sockdir: config.external.sockdir,
-      ambiguous_double: config.display.double_width_ambiguous
-    ))
+    w.swrite(config.external.sockdir)
+    w.swrite(config.display.double_width_ambiguous)
 
 proc removeChild*(forkserver: ForkServer; pid: int) =
   forkserver.ostream.withPacketWriter w:
@@ -238,10 +232,8 @@ proc runForkServer() =
           ctx.loaderPid = pid
           ctx.children.add(pid)
         of fcLoadConfig:
-          var config: ForkServerConfig
-          r.sread(config)
-          set_cjk_ambiguous(config.ambiguous_double)
-          ctx.sockDir = config.sockdir
+          r.sread(ctx.sockDir)
+          r.sread(isCJKAmbiguous)
           when defined(freebsd):
             ctx.sockDirFd = open(cstring(ctx.sockDir), O_DIRECTORY)
     except EOFError:
diff --git a/src/utils/strwidth.nim b/src/utils/strwidth.nim
index a3acbef7..fe9df92d 100644
--- a/src/utils/strwidth.nim
+++ b/src/utils/strwidth.nim
@@ -6,9 +6,7 @@ import utils/map
 include res/map/charwidth_gen
 
 # One of the few global variables in the code. Honestly, it should not exist.
-var isCJKAmbiguous = false
-proc set_cjk_ambiguous*(b: bool) =
-  isCJKAmbiguous = b
+var isCJKAmbiguous* = false
 
 # Warning: this shouldn't be called without normalization.
 func width*(r: Rune): int =