aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-04-12 08:51:36 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-04-12 08:51:36 -0400
commit70d0efc33c34dc3cbbc9ea4f54a0d87439e0ac83 (patch)
tree0cc1d167714ea85d5c4d1c05501d1e27c4c0ccfc
parentc51691cc71fa787df36ae6b2e37611e6e55ec17f (diff)
downloadtextadept-70d0efc33c34dc3cbbc9ea4f54a0d87439e0ac83.tar.gz
textadept-70d0efc33c34dc3cbbc9ea4f54a0d87439e0ac83.zip
Ouput 'cd' for run/compile commands when necessary; modules/textadept/run.lua
-rw-r--r--modules/textadept/run.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index b782c78c..42710813 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -136,7 +136,10 @@ local function run_command(commands, event)
end
local function emit_status(status) emit_output('> exit status: '..status) end
- if commands == M.build_commands then emit_output('> cd '..M.cwd) end
+ if commands == M.build_commands or
+ M.cwd ~= (buffer.filename:match('^(.+)[/\\][^/\\]+$') or '') then
+ emit_output('> cd '..M.cwd)
+ end
emit_output('> '..command:iconv('UTF-8', _CHARSET), not M.RUN_IN_BACKGROUND)
M.proc = assert(spawn(command, M.cwd, emit_output, emit_output, emit_status))
end