From 6cf7aabf04289bf1f8a68dd269b4a70fbfbef342 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 18 Feb 2020 09:27:30 -0500 Subject: Wrap searches in `textadept.run.goto_error()`. --- modules/textadept/run.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index 8b236e9f..047adcca 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -377,6 +377,8 @@ function M.goto_error(line, next) if not line and next ~= nil then local f = buffer['marker_'..(next and 'next' or 'previous')] line = buffer:line_from_position(buffer.current_pos) + local wrapped = false + ::retry:: local wline = f(buffer, line + (next and 1 or -1), 1 << M.MARK_WARNING) local eline = f(buffer, line + (next and 1 or -1), 1 << M.MARK_ERROR) if wline == -1 and eline == -1 then @@ -386,7 +388,11 @@ function M.goto_error(line, next) if wline == -1 then wline = eline else eline = wline end end line = (next and math.min or math.max)(wline, eline) - if line == -1 then return end + if line == -1 and not wrapped then + line = next and 0 or buffer.line_count + wrapped = true + goto retry + end end textadept.editing.goto_line(line) -- ensure visible -- cgit v1.2.3