diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-05-16 00:08:13 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-05-16 00:08:13 +0200 |
| commit | 12eb98edcb560302d6986596b34de087b9f88431 (patch) | |
| tree | c47ca9b29c56655bcc89841a0a3b0b44cc5475be /init.lua | |
| parent | 1bb06d6529be334c4c16d99f91b027e9f6a148d5 (diff) | |
| download | vis-open-extend-12eb98edcb560302d6986596b34de087b9f88431.tar.gz vis-open-extend-12eb98edcb560302d6986596b34de087b9f88431.zip | |
simplify setting the cursor position by using vis' file:pos_by_linecol
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -25,12 +25,10 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- fire a new WIN_OPEN event because we changed the file vis.events.emit(vis.events.WIN_OPEN, win) - -- After the other handlers ran we set the position. - vis:feedkeys(line.."G") - - if column then - vis:feedkeys(tostring(column) .. "l") - end + -- After the other handlers ran we set the position + column = column or 1 + local pos = win.file:pos_by_linecol(line, column) + vis.win.selection.pos = pos -- Stop handling the old FILE_OPEN event since we changed the file and emitted -- a new WIN_OPEN event |
