diff options
author | 2020-02-18 09:27:30 -0500 | |
---|---|---|
committer | 2020-02-18 09:27:30 -0500 | |
commit | 6cf7aabf04289bf1f8a68dd269b4a70fbfbef342 (patch) | |
tree | 93cead06472843744bb1f91c6ff47b1721d0f53b /modules/textadept | |
parent | ef75e0506d5a1fa9e85eae1eb5a1fa154961233a (diff) | |
download | textadept-6cf7aabf04289bf1f8a68dd269b4a70fbfbef342.tar.gz textadept-6cf7aabf04289bf1f8a68dd269b4a70fbfbef342.zip |
Wrap searches in `textadept.run.goto_error()`.
Diffstat (limited to 'modules/textadept')
-rw-r--r-- | modules/textadept/run.lua | 8 |
1 files changed, 7 insertions, 1 deletions
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 |