From f00019f9ffc5e0940450eb3988ef2b4aedbb01f8 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Fri, 4 Dec 2020 22:36:49 -0500 Subject: [PATCH] make external editor ux slightly less bad --- terminal.d | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/terminal.d b/terminal.d index 4e114e1..bb29c01 100644 --- a/terminal.d +++ b/terminal.d @@ -4672,7 +4672,15 @@ class LineGetter { terminal.doTermcap("te"); } } - spawnProcess([editor, tmpName]).wait; + version(Posix) { + import std.stdio; + // need to go to the parent terminal jic we're in an embedded terminal with redirection + terminal.write(" !! Editor may be in parent terminal !!"); + terminal.flush(); + spawnProcess([editor, tmpName], File("/dev/tty", "rb"), File("/dev/tty", "wb")).wait; + } else { + spawnProcess([editor, tmpName]).wait; + } if(UseVtSequences) { if(terminal.type == ConsoleOutputType.cellular) terminal.doTermcap("ti"); @@ -7102,7 +7110,7 @@ version(TerminalDirectToEmulator) { auto fp = stdout; - // FIXME: openpty + // FIXME: openpty? child processes can get a lil borked. int[2] fds; auto ret = pipe(fds);