aboutsummaryrefslogtreecommitdiff
path: root/core/gui.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/gui.lua')
-rw-r--r--core/gui.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/gui.lua b/core/gui.lua
index e6ccb9aa..f61a45b3 100644
--- a/core/gui.lua
+++ b/core/gui.lua
@@ -139,7 +139,11 @@ end
-- `false`.
-- @name goto_file
function gui.goto_file(filename, split, preferred_view, sloppy)
- local patt = not sloppy and '^'..filename..'$' or filename..'$'
+ local patt = '^'..filename..'$'
+ if sloppy then
+ local i = filename:reverse():find('[/\\]%.%.?') -- ./ or ../
+ patt = i and filename:sub(-i + 1, -1)..'$' or filename..'$'
+ end
if #_VIEWS == 1 and split and not (view.buffer.filename or ''):find(patt) then
view:split()
else