aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/file_io.lua4
-rw-r--r--modules/textadept/find.lua6
-rw-r--r--modules/textadept/run.lua9
3 files changed, 16 insertions, 3 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 6c66632e..a79f907c 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -206,7 +206,7 @@ local function set_encoding(buffer, encoding)
buffer.encoding, buffer.encoding_bom = encoding, io.boms[encoding]
end
-- Sets the default buffer encoding.
-events_connect(events.BUFFER_NEW, function()
+events_connect(events.BUFFER_NEW, function()
buffer.set_encoding, buffer.encoding = set_encoding, 'UTF-8'
end)
@@ -361,7 +361,7 @@ local vcs = {'.bzr', '.git', '.hg', '.svn', 'CVS'}
-- @param path Optional filesystem path to a project or a file contained within
-- a project. The default value is the buffer's filename or the current
-- working directory.
--- @return string root
+-- @return string root or nil
-- @name get_project_root
function io.get_project_root(path)
local root
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index dda00c9a..bd9c8825 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -374,6 +374,12 @@ function M.goto_file_found(line, next)
ui.goto_file(file:iconv(_CHARSET, 'UTF-8'), true, preferred_view)
textadept.editing.goto_line(line_num)
end
+events.connect(events.KEYPRESS, function(code)
+ if keys.KEYSYMS[code] == '\n' and is_ff_buf(buffer) then
+ M.goto_file_found(buffer:line_from_position(buffer.current_pos))
+ return true
+ end
+end)
events.connect(events.DOUBLE_CLICK, function(pos, line)
if is_ff_buf(buffer) then M.goto_file_found(line) end
end)
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 77748fdb..f07ead03 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -298,7 +298,7 @@ function M.goto_error(line, next)
buffer:goto_line(line)
-- Goto the warning or error and show an annotation.
- local error = get_error(buffer:get_line(line):match('^[^\r\n]+'))
+ local error = get_error(buffer:get_line(line):match('^[^\r\n]*'))
if not error then if CURSES then view:goto_buffer(cur_buf) end return end
textadept.editing.select_line()
ui.goto_file(M.cwd..error.filename, true, preferred_view, true)
@@ -309,6 +309,13 @@ function M.goto_error(line, next)
if not error.warning then buffer.annotation_style[line - 1] = 8 end -- error
end
end
+events.connect(events.KEYPRESS, function(code)
+ if keys.KEYSYMS[code] == '\n' and is_msg_buf(buffer) and M.cwd and
+ get_error(buffer:get_cur_line():match('^[^\r\n]*')) then
+ M.goto_error(buffer:line_from_position(buffer.current_pos))
+ return true
+ end
+end)
events.connect(events.DOUBLE_CLICK, function(pos, line)
if is_msg_buf(buffer) and M.cwd then M.goto_error(line) end
end)