From 40a871371205696b164a2017abf4cc7126fa2382 Mon Sep 17 00:00:00 2001 From: glacambre Date: Fri, 19 Apr 2019 06:54:02 +0200 Subject: [PATCH] Actually make tridactyl listen for `:editor` return code This piece of code was missing from 91dffe6. This actually closes #1455. Note that you need your terminal emulator to forward the exit code of your editor in order for this to work. --- src/lib/native.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/native.ts b/src/lib/native.ts index c7016bb1..e3b0dde0 100644 --- a/src/lib/native.ts +++ b/src/lib/native.ts @@ -250,11 +250,14 @@ export async function editor(file: string, line: number, col: number, content?: : config.get("editorcmd")) .replace(/%l/, line) .replace(/%c/, col) + let exec if (editorcmd.indexOf("%f") !== -1) { - await run(editorcmd.replace(/%f/, file)) + exec = await run(editorcmd.replace(/%f/, file)) } else { - await run(editorcmd + " " + file) + exec = await run(editorcmd + " " + file) } + if (exec.code != 0) + return exec return read(file) }