aboutsummaryrefslogtreecommitdiffhomepage
path: root/init.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-04-07 15:50:49 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2018-04-07 15:50:49 -0400
commit137a845bef51f00917efe3e626f26c4e0a105f4e (patch)
tree3051f8d9db62e5615a457838844bb7ba118d958e /init.lua
parentc205597b711bf8d1343b02fa9864a268f7834205 (diff)
Fixed stale styles on split view.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 63263ee7..b5f46760 100644
--- a/init.lua
+++ b/init.lua
@@ -310,5 +310,18 @@ events.connect(events.VIEW_NEW, function()
end
-- Since BUFFER_NEW loads themes and settings on startup, only load them for
-- subsequent views.
- if #_VIEWS > 1 then load_settings() end
+ if #_VIEWS > 1 then
+ load_settings()
+ -- Refresh styles since the user may have altered style settings.
+ -- When load_settings() calls `buffer.property['style.default'] = ...`, the
+ -- LPeg lexer resets all styles to that default. However, load_settings()
+ -- may later call a user's `buffer.property['fontsize'] = ...`, which
+ -- 'style.default' references. Styles are now stale and need refreshing.
+ -- This is not an issue in BUFFER_NEW since a lexer is set immediately
+ -- afterwards, which refreshes styles.
+ -- Note: for some reason, calling SETDOCPOINTER before SETLEXERLANGUAGE is
+ -- not needed in this case.
+ local SETLEXERLANGUAGE = _SCINTILLA.properties.lexer_language[2]
+ buffer:private_lexer_call(SETLEXERLANGUAGE, buffer._lexer)
+ end
end, 1)