aboutsummaryrefslogtreecommitdiff
path: root/plugins/unboundedscroll.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-03-11 05:08:59 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-22 13:16:10 -0400
commitb68091bf1fb3f0935390f0d4bb38e55194f18ade (patch)
tree36797a6d94f0d5631e3ab050c2046bdbc427f39c /plugins/unboundedscroll.lua
parente352965957917b2aaa6437452306af4031c8e552 (diff)
downloadlite-xl-plugins-b68091bf1fb3f0935390f0d4bb38e55194f18ade.tar.gz
lite-xl-plugins-b68091bf1fb3f0935390f0d4bb38e55194f18ade.zip
unboundedscroll: added command to toggle
Diffstat (limited to 'plugins/unboundedscroll.lua')
-rw-r--r--plugins/unboundedscroll.lua18
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,
+})