aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-11-01 15:36:50 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-11-01 15:58:49 +0100
commitc4aaea6a0ec0438d6bd0da1c0650fe5ff272abe6 (patch)
treeb4efddc2c77bf72c7eb2cccea41a341f35fad4f7
parent0baf5945bca147d09e29920e07ba43c187484238 (diff)
downloadvis-c4aaea6a0ec0438d6bd0da1c0650fe5ff272abe6.tar.gz
vis-c4aaea6a0ec0438d6bd0da1c0650fe5ff272abe6.tar.xz
vis: abort syntax highlighting if viewport is invalid
In theory this should not happen in the first place, but in practice it might fix the symptoms reported in issue #367.
-rw-r--r--vis.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/vis.lua b/vis.lua
index f4a5232..c8d1bb3 100644
--- a/vis.lua
+++ b/vis.lua
@@ -345,6 +345,9 @@ vis.events.win_highlight = function(win, horizon_max)
-- TODO: improve heuristic for initial style
local viewport = win.viewport
+ if not viewport then
+ return
+ end
local horizon = viewport.start < horizon_max and viewport.start or horizon_max
local view_start = viewport.start
local lex_start = viewport.start - horizon