about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-23 13:14:37 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-23 13:14:37 +0200
commit8b517a111d6020f448ff747ac4a2555d2e4160dc (patch)
treee9d3d7cd082a49f633e32cd2576c18d8384bdc22 /src
parent9816f04f7a31c609cf83e7ea1fbf8d33cdb98c4f (diff)
downloadchawan-8b517a111d6020f448ff747ac4a2555d2e4160dc.tar.gz
config: fix JS command definitions
Diffstat (limited to 'src')
-rw-r--r--src/config/config.nim2
-rw-r--r--src/local/client.nim5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/config/config.nim b/src/config/config.nim
index 9ce5d89a..8783cb89 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -678,7 +678,7 @@ proc parseConfigValue(ctx: var ConfigParser; x: var CommandConfig; v: TomlValue;
     if vv.t == tvtTable:
       ctx.parseConfigValue(x, vv, kkk)
     else: # tvtString
-      x.init.add((kkk, vv.s))
+      x.init.add((kkk.substr("cmd.".len), vv.s))
 
 type ParseConfigResult* = object
   success*: bool
diff --git a/src/local/client.nim b/src/local/client.nim
index 24510106..ad4bfaff 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -183,8 +183,9 @@ proc alert(client: Client; msg: string) {.jsfunc.} =
   client.pager.alert(msg)
 
 proc evalActionJS(client: Client; action: string): JSValue =
-  client.config.cmd.map.withValue(action, p):
-    return JS_DupValue(client.jsctx, p[])
+  if action.startsWith("cmd."):
+    client.config.cmd.map.withValue(action.substr("cmd.".len), p):
+      return JS_DupValue(client.jsctx, p[])
   return client.evalJS(action, "<command>")
 
 # Warning: this is not re-entrant.