aboutsummaryrefslogtreecommitdiff
path: root/plugins/unboundedscroll.lua
blob: 0793cfa0e7412afc1dedce7a7a3ab91744f44d25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- mod-version:3
local command = require "core.command"
local DocView = require "core.docview"

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,
})