aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorMichiel van den Heuvel <michielvdnheuvel@gmail.com>2023-06-08 19:17:52 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-06-12 18:23:30 +0200
commit63b8d2ce0e0fd62833c4d795383411b77673ead6 (patch)
tree2bde47a0e86a2d481c3269fc723d118ea6eaf253 /init.lua
parent4dcc77f638829110b8b6417272fcbf07bde64a24 (diff)
downloadvis-lspc-63b8d2ce0e0fd62833c4d795383411b77673ead6.tar.gz
vis-lspc-63b8d2ce0e0fd62833c4d795383411b77673ead6.zip
Avoid screen flicker when navigating within file
When using vis_open_doc_pos, don't reopen the file if the path of the opened file and the doc_pos match.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index bcf6099..9125940 100644
--- a/init.lua
+++ b/init.lua
@@ -299,9 +299,13 @@ local function vis_open_doc_pos(doc_pos, cmd, win)
vis.win = win
end
assert(cmd)
- vis:command(string.format('%s \'%s\'', cmd, doc_pos.file))
- vis.win.selection:to(doc_pos.line, doc_pos.col)
- vis:command('lspc-open')
+ if vis.win.file.path ~= doc_pos.file then
+ vis:command(string.format('%s \'%s\'', cmd, doc_pos.file))
+ vis.win.selection:to(doc_pos.line, doc_pos.col)
+ vis:command('lspc-open')
+ else
+ vis.win.selection:to(doc_pos.line, doc_pos.col)
+ end
end
-- Support jumping between document positions