diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2023-09-21 22:15:26 -0600 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2023-12-05 20:01:33 -0700 |
| commit | 0f7ddc170b908004037455ce716317cdd44cd83f (patch) | |
| tree | 4fe570ea1fb4e156342dec8ba8f13534861cae6a | |
| parent | b947312bfc8e0d987deca392961a833e3ac7be1e (diff) | |
| download | vis-0f7ddc170b908004037455ce716317cdd44cd83f.tar.gz vis-0f7ddc170b908004037455ce716317cdd44cd83f.tar.xz | |
lua: drop redrawtime option
This hasn't worked in almost a year and even if it did it makes no
sense. Based on my testing lexing takes a couple milliseconds at
most. If it took 1 second (the default value for this option) vis
would be completely unusable.
If people want support for this it should be submitted upstream
and vis will act based on the outcome of that.
closes #1122: lexer no longer obeys redrawtime
| -rw-r--r-- | lua/vis-std.lua | 16 | ||||
| -rw-r--r-- | man/vis.1 | 3 |
2 files changed, 1 insertions, 18 deletions
diff --git a/lua/vis-std.lua b/lua/vis-std.lua index 4a6bfdf..2a2f91b 100644 --- a/lua/vis-std.lua +++ b/lua/vis-std.lua @@ -59,17 +59,6 @@ vis:option_register("horizon", "number", function(horizon) return true end, "Number of bytes to consider for syntax highlighting") -vis:option_register("redrawtime", "string", function(redrawtime) - if not vis.win then return false end - local value = tonumber(redrawtime) - if not value or value <= 0 then - vis:info("A positive real number expected") - return false - end - vis.win.redrawtime = value - return true -end, "Seconds to wait for syntax highlighting before aborting it") - vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) if not win.syntax or not vis.lexers.load then return end local lexer = vis.lexers.load(win.syntax, nil, true) @@ -78,7 +67,6 @@ vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) -- TODO: improve heuristic for initial style local viewport = win.viewport if not viewport then return end - local redrawtime_max = win.redrawtime or 1.0 local horizon_max = win.horizon or 32768 local horizon = viewport.start < horizon_max and viewport.start or horizon_max local view_start = viewport.start @@ -86,11 +74,9 @@ vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win) viewport.start = lex_start local data = win.file:content(viewport) local token_styles = lexer._TOKENSTYLES - local tokens, timedout = lexer:lex(data, 1, redrawtime_max) + local tokens = lexer:lex(data, 1) local token_end = lex_start + (tokens[#tokens] or 1) - 1 - if timedout then return end - for i = #tokens - 1, 1, -2 do local token_start = lex_start + (tokens[i-1] or 1) - 1 if token_end < view_start then @@ -1379,9 +1379,6 @@ Highlight a fixed column. .It Ic horizon Op Ar 32768 How many bytes back the lexer will look to synchronize parsing. . -.It Ic redrawtime Op Ar 1.0 -Maximum time (in seconds) to wait for syntax highlighting before aborting it. -. .It Ic theme Op Do default-16 Dc or Do default-256 Dc Color theme to use, name without file extension. Loaded from a |
