diff options
author | bptato <nincsnevem662@gmail.com> | 2024-10-07 22:08:27 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-10-07 22:10:59 +0200 |
commit | 8edbc32b4f2787dfe968b1f356aac52febf05507 (patch) | |
tree | d500c2c46f2ab23de2238ccf51a064d651b4d270 /src/local | |
parent | 3b73117b263ea6ae9fdff7005383bb969c593c4f (diff) | |
download | chawan-8edbc32b4f2787dfe968b1f356aac52febf05507.tar.gz |
pager: do not choke on empty editor command
Diffstat (limited to 'src/local')
-rw-r--r-- | src/local/pager.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim index f5480c6f..f757f1d0 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -1169,7 +1169,7 @@ proc getEditorCommand(pager: Pager; file: string; line = 1): string {.jsfunc.} = editor = uqEditor.get & " +%d" var canpipe = true var s = unquoteCommand(editor, "", file, nil, canpipe, line) - if canpipe: + if s.len > 0 and canpipe: # %s not in command; add file name ourselves if s[^1] != ' ': s &= ' ' @@ -1182,7 +1182,9 @@ proc openInEditor(pager: Pager; input: var string): bool = if input != "": writeFile(tmpf, input) let cmd = pager.getEditorCommand(tmpf) - if pager.term.runProcess(cmd): + if cmd == "": + pager.alert("invalid external.editor command") + elif pager.term.runProcess(cmd): if fileExists(tmpf): input = readFile(tmpf) removeFile(tmpf) |