From c75e5899db73f3a1f05c43b3bfd8a6ec80ff8a89 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 19 Sep 2019 11:53:02 -0400 Subject: Properly handle absolute paths in run output and case-insensitivity on Windows. --- core/ui.lua | 5 +++++ modules/textadept/run.lua | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/ui.lua b/core/ui.lua index 9f940e32..0d1c72bb 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -243,6 +243,11 @@ end -- @name goto_file function ui.goto_file(filename, split, preferred_view, sloppy) local patt = '^'..filename..'$' -- TODO: escape filename properly + if WIN32 then + filename = filename:gsub('%a', function(letter) + return string.format('[%s%s]', letter:upper(), letter:lower()) + end) + end if sloppy then patt = filename:match('[^/\\]+$')..'$' end if #_VIEWS == 1 and split and not (view.buffer.filename or ''):find(patt) then view:split() diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index 4c92c433..a150ba77 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -379,8 +379,10 @@ function M.goto_error(line, next) local error = scan_for_error(line:iconv(_CHARSET, 'UTF-8')) if not error then return end textadept.editing.select_line() - ui.goto_file(cwd..(not WIN32 and '/' or '\\')..error.filename, true, - preferred_view, true) + if not error.filename:find(not WIN32 and '^/' or '^%a:[/\\]') then + error.filename = cwd..(not WIN32 and '/' or '\\')..error.filename + end + ui.goto_file(error.filename, true, preferred_view, true) textadept.editing.goto_line(error.line - 1) if error.column then buffer:goto_pos(buffer:find_column(error.line - 1, error.column - 1)) -- cgit v1.2.3