aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept')
-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