Skip to content

Commit

Permalink
fix(core.ui): do not modify the user's scrolloffset
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Jan 6, 2023
1 parent 310ebaa commit bd2e58c
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions lua/neorg/modules/core/ui/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ module.public = {
-- Get the name of the buffer with the specified ID
local name = vim.api.nvim_buf_get_name(buf)

if module.private.user_scrolloff then
vim.o.scrolloff = module.private.user_scrolloff
end

if module.private.windows[name] ~= nil then
-- Attempt to force close both the window and the buffer
vim.api.nvim_win_close(module.private.windows[name], true)
Expand Down Expand Up @@ -137,14 +133,6 @@ module.public = {
vim.api.nvim_buf_set_name(buf, bufname)
vim.api.nvim_win_set_buf(0, buf)

-- Keep user scrolloff for when the ui is closed
-- We can't use vim.o.scrolloff here because it seems to get a weird value...
module.private.user_scrolloff = vim.api.nvim_get_option("scrolloff")

vim.api.nvim_buf_call(buf, function()
vim.cmd("set scrolloff=999")
end)

vim.api.nvim_win_set_option(0, "number", false)
vim.api.nvim_win_set_option(0, "relativenumber", false)

Expand All @@ -167,7 +155,7 @@ module.public = {
---@param name string the name of the buffer
---@param config table a table of <option> = <value> keypairs signifying buffer-local options for the buffer contained within the split
---@param left boolean if true will spawn the vertical split on the left (default is right)
---@return buffer the buffer of the vertical split
---@return number #The buffer of the vertical split
create_vsplit = function(name, config, left)
vim.validate({
name = { name, "string" },
Expand Down Expand Up @@ -355,10 +343,6 @@ module.public = {
end,
}

module.private = {
user_scrolloff = nil,
}

module.examples = {
["Create a selection popup"] = function()
-- Creates the buffer
Expand Down

0 comments on commit bd2e58c

Please sign in to comment.