about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--res/config.toml2
-rw-r--r--src/config/chapath.nim3
-rw-r--r--src/local/pager.nim4
3 files changed, 5 insertions, 4 deletions
diff --git a/res/config.toml b/res/config.toml
index 3ace21bd..23f37846 100644
--- a/res/config.toml
+++ b/res/config.toml
@@ -238,7 +238,7 @@ urimethodmap = [
 	"/usr/local/etc/w3m/urimethodmap"
 ]
 tmpdir = "/tmp/cha"
-editor = "${EDITOR:-vi +%d %s}"
+editor = "${EDITOR:-vi}"
 cgi-dir = "${%CHA_LIBEXEC_DIR}/cgi-bin"
 download-dir = "/tmp/"
 w3m-cgi-compat = false
diff --git a/src/config/chapath.nim b/src/config/chapath.nim
index c02a3f1e..d9ba3c50 100644
--- a/src/config/chapath.nim
+++ b/src/config/chapath.nim
@@ -145,7 +145,7 @@ proc stateCurly(ctx: var UnquoteContext; c: char): ChaPathResult[void] =
     ctx.identStr &= c
     return ok()
   of ':', '-', '?', '+': # note: we don't support `=' (assign)
-    if ctx.identStr.len > 0:
+    if ctx.identStr.len == 0:
       return err("substitution without parameter name")
     if c == ':':
       ctx.state = usCurlyColon
@@ -235,6 +235,7 @@ proc flushCurlyExpand(ctx: var UnquoteContext; word: string):
   else: assert false
   ctx.subChar = '\0'
   ctx.hasColon = false
+  ctx.state = usNormal
   return ok()
 
 proc stateCurlyExpand(ctx: var UnquoteContext; c: char): ChaPathResult[void] =
diff --git a/src/local/pager.nim b/src/local/pager.nim
index e9e95895..b2cd779c 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -829,8 +829,8 @@ proc getEditorCommand(pager: Pager; file: string; line = 1): string {.jsfunc.} =
   var editor = pager.config.external.editor
   if (let uqEditor = ChaPath(editor).unquote(); uqEditor.isSome):
     if uqEditor.get in ["vi", "nvi", "vim", "nvim"]:
-      editor &= " +%d"
-  var canpipe = false
+      editor = uqEditor.get & " +%d"
+  var canpipe = true
   var s = unquoteCommand(editor, "", file, nil, canpipe, line)
   if canpipe:
     # %s not in command; add file name ourselves