aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/run.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-09-28 17:04:18 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2011-09-28 17:04:18 -0400
commit851ebfe28a7c2c157cdf17d4623cb954dc3802ea (patch)
treec911d2bdcc146210e31f9833e53e6295b6de03a5 /modules/textadept/run.lua
parent132e362f44e00cd93e04967efbfc138c53a47ee4 (diff)
downloadtextadept-851ebfe28a7c2c157cdf17d4623cb954dc3802ea.tar.gz
textadept-851ebfe28a7c2c157cdf17d4623cb954dc3802ea.zip
Added gui.goto_file() for the 'find' and 'run' modules.
Diffstat (limited to 'modules/textadept/run.lua')
-rw-r--r--modules/textadept/run.lua36
1 files changed, 19 insertions, 17 deletions
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 39a71db1..8e1561f3 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -135,24 +135,26 @@ error_detail = {}
-- @param line_num The line double-clicked.
-- @see error_detail
function goto_error(pos, line_num)
- local type = buffer._type
- if type == L('[Message Buffer]') or type == L('[Error Buffer]') then
- line = buffer:get_line(line_num)
- for _, error_detail in pairs(error_detail) do
- local captures = { line:match(error_detail.pattern) }
- if #captures > 0 then
- local utf8_filename = captures[error_detail.filename]
- local filename = utf8_filename:iconv(_CHARSET, 'UTF-8')
- if lfs.attributes(filename) then
- io.open_file(utf8_filename)
- _m.textadept.editing.goto_line(captures[error_detail.line])
- local msg = captures[error_detail.message]
- if msg then buffer:call_tip_show(buffer.current_pos, msg) end
- else
- error(string.format('"%s" %s', utf8_filename, L('does not exist')))
- end
- break
+ if buffer._type ~= L('[Message Buffer]') and
+ buffer._type ~= L('[Error Buffer]') then
+ return
+ end
+ local buffer = buffer
+ line = buffer:get_line(line_num)
+ for _, error_detail in pairs(error_detail) do
+ local captures = { line:match(error_detail.pattern) }
+ if #captures > 0 then
+ local utf8_filename = captures[error_detail.filename]
+ local filename = utf8_filename:iconv(_CHARSET, 'UTF-8')
+ if lfs.attributes(filename) then
+ gui.goto_file(utf8_filename, true)
+ _m.textadept.editing.goto_line(captures[error_detail.line])
+ local msg = captures[error_detail.message]
+ if msg then buffer:call_tip_show(buffer.current_pos, msg) end
+ else
+ error(string.format('"%s" %s', utf8_filename, L('does not exist')))
end
+ return
end
end
end