From c40d56cde2473a52e00f263c484dc9b1e80bd380 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Thu, 17 Mar 2022 18:39:03 -0400 Subject: Fixed calling `view:set_theme()` from the command entry. --- init.lua | 5 +++++ 1 file changed, 5 insertions(+) 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.) -- cgit v1.2.3