Fix #3800: daft bug

I really feel like the tooling should have told us about
this
This commit is contained in:
Oliver Blanthorn 2021-06-26 22:13:49 +02:00
parent baae7018a9
commit 1a4dcddec2
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3

View file

@ -337,6 +337,7 @@ export async function editor() {
return undefined
}
let ans
try {
let text = ""
let line = 0
@ -347,18 +348,20 @@ export async function editor() {
})(elem)
const file = (await Native.temp(text, document.location.hostname)).content
const exec = await Native.editor(file, line, col)
console.log(exec)
if (exec.code == 0) {
fillinput(selector, exec.content)
// TODO: add annoying "This message was written with [Tridactyl](https://addons.mozilla.org/en-US/firefox/addon/tridactyl-vim/)" to everything written using editor
return [file, exec.content]
ans = [file, exec.content]
} else {
logger.debug(`Editor terminated with non-zero exit code: ${exec.code}`)
}
} catch (e) {
throw new Error(`:editor failed: ${e}`)
} finally {
return removeTridactylEditorClass(selector)
removeTridactylEditorClass(selector)
return ans
}
}