aboutsummaryrefslogtreecommitdiff
path: root/plugins/settings.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-11-15 20:25:24 -0400
committerjgmdev <jgmdev@gmail.com>2022-11-15 20:25:24 -0400
commit83aab1c85eeca221fd27a242b59aec642a3598ef (patch)
treebbc5d79991e18f09dd9c833e60fda32850ab355e /plugins/settings.lua
parent20cd0e16d2b37586e4946e066cc5b604d3ec4035 (diff)
downloadlite-xl-plugins-83aab1c85eeca221fd27a242b59aec642a3598ef.tar.gz
lite-xl-plugins-83aab1c85eeca221fd27a242b59aec642a3598ef.zip
settings: support global force scrollbar status on newly opened Views
Diffstat (limited to 'plugins/settings.lua')
-rw-r--r--plugins/settings.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/settings.lua b/plugins/settings.lua
index 89796b1..6637a81 100644
--- a/plugins/settings.lua
+++ b/plugins/settings.lua
@@ -5,6 +5,7 @@ local common = require "core.common"
local command = require "core.command"
local keymap = require "core.keymap"
local style = require "core.style"
+local View = require "core.view"
local DocView = require "core.docview"
-- check if widget is installed before proceeding
@@ -1921,5 +1922,21 @@ if config.plugins.toolbarview ~= false then
end
end
+--------------------------------------------------------------------------------
+-- Overwrite View:new to allow setting force scrollbar status globally
+--------------------------------------------------------------------------------
+local view_new = View.new
+function View:new()
+ view_new(self)
+ local mode = config.force_scrollbar_status_mode or "global"
+ local globally = mode == "global"
+ if globally then
+ --This is delayed to allow widgets to also apply it to child views/widgets
+ core.add_thread(function()
+ self.v_scrollbar:set_forced_status(config.force_scrollbar_status)
+ self.h_scrollbar:set_forced_status(config.force_scrollbar_status)
+ end)
+ end
+end
return settings;