Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scroll): disable scroll animation for dashboard filetypes #85

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/cinnamon.nvim.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*cinnamon.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 July 23
*cinnamon.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 July 25

==============================================================================
Table of Contents *cinnamon.nvim-table-of-contents*
Expand Down
5 changes: 5 additions & 0 deletions lua/cinnamon/scroll.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ local H = {}
---@field winline number
---@field wincol number

local disabled_filetypes = {
dashboard = true,
}

---@param command string | function
---@param options? ScrollOptions
M.scroll = function(command, options)
Expand Down Expand Up @@ -88,6 +92,7 @@ H.scroller = {
and vim.fn.reg_executing() == "" -- A macro is not being executed
and original_buffer_id == self.buffer_id
and original_window_id == self.window_id
and not disabled_filetypes[vim.bo[self.buffer_id].filetype]
and (not self.window_only or H.window_scrolled(original_view, self.target_view))
and (not self.options.max_delta.line or (math.abs(self.error.line) <= self.options.max_delta.line))
and (not self.options.max_delta.column or (math.abs(self.error.col) <= self.options.max_delta.column))
Expand Down
Loading