From 29ad51fe9f2448c1323e4cd1d07f07909b9d78e6 Mon Sep 17 00:00:00 2001 From: Giorgio Calderone Date: Sun, 12 Apr 2020 00:49:02 +0200 Subject: [PATCH] Fixed writing output in gnuplot repl mode --- src/Gnuplot.jl | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Gnuplot.jl b/src/Gnuplot.jl index 7338a74..0ed39cd 100644 --- a/src/Gnuplot.jl +++ b/src/Gnuplot.jl @@ -89,6 +89,7 @@ end # ╰───────────────────────────────────────────────────────────────────╯ const sessions = OrderedDict{Symbol, Session}() const options = Options() +const isgnuplotrepl = [false] # ╭───────────────────────────────────────────────────────────────────╮ @@ -311,15 +312,15 @@ function GPSession(sid::Symbol) line *= c for token in pagerTokens() # handle pager interaction if (length(line) == length(token)) && (line == token) - break + return line end end end - # TODO if (line != "GNUPLOT_CAPTURE_BEGIN") && - # TODO (line != "GNUPLOT_CAPTURE_END") && - # TODO (Base.active_repl.mistate.current_mode.prompt == "gnuplot> ") - # TODO println(stdout, line) - # TODO end + if isgnuplotrepl[1] && + (line != "GNUPLOT_CAPTURE_BEGIN") && + (line != "GNUPLOT_CAPTURE_END") + println(stdout, line) + end return line end @@ -1734,7 +1735,9 @@ Note: the gnuplot REPL operates only on the default session. """ function repl_init(start_key='>') function repl_exec(s) + isgnuplotrepl[1] = true writeread(getsession(), s) + isgnuplotrepl[1] = false nothing end