diff options
| author | Matěj Cepl <mcepl@cepl.eu> | 2024-10-22 14:07:53 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-05-16 00:03:14 +0200 |
| commit | 1bb06d6529be334c4c16d99f91b027e9f6a148d5 (patch) | |
| tree | dccb1966f097f610e4c04fc40f2849ca8e74fb3e | |
| parent | a230f0ac3fbd0a9540329b7951b1e8f3eda797de (diff) | |
| download | vis-open-extend-1bb06d6529be334c4c16d99f91b027e9f6a148d5.tar.gz vis-open-extend-1bb06d6529be334c4c16d99f91b027e9f6a148d5.zip | |
parse even file names with column or additional colon characters
| -rw-r--r-- | init.lua | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -16,8 +16,8 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) return end - local _, _, path, line = string.find(ref, "^(.+):(%d+)$") - if path == nil or line == nil or line == 1 or not file_exists(path) then + local path, line, column = ref:match("^(.-):(%d+):?(%d*):?$") + if not path or not line or tonumber(line) == 1 or not file_exists(path) then return end @@ -28,8 +28,14 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- After the other handlers ran we set the position. vis:feedkeys(line.."G") + if column then + vis:feedkeys(tostring(column) .. "l") + end + -- Stop handling the old FILE_OPEN event since we changed the file and emitted -- a new WIN_OPEN event + + -- Prevent further WIN_OPEN event handlers from running return true end) |
