diff options
Diffstat (limited to 'plugins/unboundedscroll.lua')
-rw-r--r-- | plugins/unboundedscroll.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/unboundedscroll.lua b/plugins/unboundedscroll.lua index 01ac6ea..93f8144 100644 --- a/plugins/unboundedscroll.lua +++ b/plugins/unboundedscroll.lua @@ -1,6 +1,18 @@ -- mod-version:3 --lite-xl 2.1 +local command = require "core.command" local DocView = require "core.docview" -function DocView.clamp_scroll_position() - -- do nothing -end +local doc_view_clamp_scroll_position = DocView.clamp_scroll_position +local function clamp_scroll_noop() end + +DocView.clamp_scroll_position = clamp_scroll_noop + +command.add(nil, { + ["unbounded-scroll:toggle"] = function() + if DocView.clamp_scroll_position == clamp_scroll_noop then + DocView.clamp_scroll_position = doc_view_clamp_scroll_position + else + DocView.clamp_scroll_position = clamp_scroll_noop + end + end, +}) |