aboutsummaryrefslogtreecommitdiffhomepage
path: root/init.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-06-16 23:54:22 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-06-16 23:54:22 -0400
commitda66b2b60f3318065a0a26b909274bdbd1abe8af (patch)
tree0a6aa2a8b6d0aa39e0a557d8042424a243596e0e /init.lua
parent0f83627a9485ef2835cd9b2082c03496862d9eb6 (diff)
Fixed `buffer:set_theme()` for lexers that have their own styles.
The default lexer styles were being refreshed, but not any custom styles defined by the lexer.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/init.lua b/init.lua
index 6fc55196..947876d6 100644
--- a/init.lua
+++ b/init.lua
@@ -25,6 +25,10 @@ local function set_theme(buffer, name, props)
dofile(name)
_G.buffer = orig_buffer
for prop, value in pairs(props or {}) do buffer.property[prop] = value end
+ -- Force reload of all styles since the current lexer may have defined its own
+ -- styles. (The LPeg lexer has only refreshed default lexer styles.)
+ local SETLEXERLANGUAGE = _SCINTILLA.properties.lexer_language[2]
+ buffer:private_lexer_call(SETLEXERLANGUAGE, buffer._lexer or 'text')
end
events.connect(events.BUFFER_NEW, function() buffer.set_theme = set_theme end)
buffer.set_theme = set_theme -- needed for the first buffer