aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2022-03-17 18:39:03 -0400
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2022-03-17 18:39:03 -0400
commitc40d56cde2473a52e00f263c484dc9b1e80bd380 (patch)
tree248baba90c70c943ef01ac933a1e643b27af4108
parentf81316624d077360447fd4ba977b7cb22ee2061b (diff)
Fixed calling `view:set_theme()` from the command entry.
-rw-r--r--init.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 67226b9b..6b7da9f5 100644
--- a/init.lua
+++ b/init.lua
@@ -28,6 +28,11 @@ local function set_theme(view, name, env)
if not assert_type(env, 'table/nil', 3) then env = {} end
local orig_view = _G.view
if view ~= orig_view then ui.goto_view(view) end
+ -- In the event the command entry is calling this function, tell the LPeg lexer that this view
+ -- (LexerLPeg instance) is the one to set styles for (as opposed to the command entry's view).
+ -- See note in LexerLPeg::Init(). Otherwise, this call is harmless and does not end up doing
+ -- much extra work.
+ buffer:private_lexer_call(SETLEXER, buffer._lexer or 'text')
loadfile(name, 't', setmetatable(env, {__index = _G}))()
-- Force reload of all styles since the current lexer may have defined its own styles. (The
-- LPeg lexer has only refreshed default lexer styles.)