From 892edb00db9f3118f655921c18756f7c30b179a3 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 22 Apr 2014 20:27:59 -0400 Subject: Message buffer can send input to spawned processes; modules/textadept/run.lua --- modules/textadept/run.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules') diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index 9a3e561b..764a994e 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -230,6 +230,16 @@ events.connect(events.BUILD_OUTPUT, print_output) -- @name stop function M.stop() if M.proc then M.proc:kill() end end +-- Send line as input to process stdin on return. +events.connect(events.CHAR_ADDED, function(char) + local proc = M.proc + if char == 10 and proc and proc.status and proc:status() == 'running' and + buffer._type == _L['[Message Buffer]'] then + local line_num = buffer:line_from_position(buffer.current_pos) - 1 + proc:write((buffer:get_line(line_num))) + end +end) + --- -- List of warning and error string patterns that match various compile and run -- warnings and errors. -- cgit v1.2.3