cinnamon.nvim icon indicating copy to clipboard operation
cinnamon.nvim copied to clipboard

Bouncy buffer

Open NicolasGB opened this issue 1 year ago • 2 comments

I've noticed on versions > 1.2.3 that the text bounces.

It looks like it happens with lines that fill the buffer window when the wrap is activated, and on the lines that overflow, i've tried to reproduce it and find a reliable way of doing so, but haven't been able to.

It happens in both 1.2.4 and 1.2.5, but when i go back to 1.2.3 the bouncing never appears.

Here's a video of what's happening:

https://github.com/user-attachments/assets/447067e6-c975-48dd-bd66-832a3579aaea

To reproduce i've used this minimal lua file:

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
	spec = {
		{
			"mrcjkb/rustaceanvim",
			version = "^4",
			init = function()
				-- Configure rustaceanvim here
				vim.g.rustaceanvim = {}
			end,
			lazy = false,
		},
		{
			"williamboman/mason.nvim",
			config = function()
				require("mason").setup({})
			end,
		},
		{
			"neovim/nvim-lspconfig",
		},
		{
			"declancm/cinnamon.nvim",
			-- version = "1.2.3",
			config = function()
				require("cinnamon").setup({
					keymaps = { extra = false },
				})
				local cinnamon = require("cinnamon")

				-- Toggle scrolling off in large fields
				vim.keymap.set("n", "<leader>ts", function()
					require("cinnamon.config").disabled = not require("cinnamon.config").disabled
				end, { desc = "Toggle smooth scrolling" })

				-- Centered scrolling:
				vim.keymap.set("n", "<C-u>", function()
					cinnamon.scroll("<C-u>zz")
				end)
				vim.keymap.set({ "n", "x" }, "<C-d>", function()
					cinnamon.scroll("<C-d>zz")
				end)
				vim.keymap.set({ "n", "x" }, "G", function()
					cinnamon.scroll("Gzz")
				end)

				-- Line scroll
				vim.keymap.set({ "n", "v" }, "H", function()
					cinnamon.scroll("^")
				end)
				vim.keymap.set({ "n", "v" }, "L", function()
					cinnamon.scroll("$")
				end)
				vim.keymap.set({ "n", "x" }, "0", function()
					cinnamon.scroll("0")
				end)

				-- End
				vim.keymap.set({ "n", "x" }, "e", function()
					cinnamon.scroll("e")
				end)
				vim.keymap.set({ "n", "x" }, "E", function()
					cinnamon.scroll("E")
				end)
				-- Backward
				vim.keymap.set({ "n", "x" }, "b", function()
					cinnamon.scroll("b")
				end)
				vim.keymap.set({ "n", "x" }, "B", function()
					cinnamon.scroll("B")
				end)
				-- Down
				vim.keymap.set({ "n", "x" }, "j", function()
					cinnamon.scroll("j")
				end)
				-- Up
				vim.keymap.set({ "n", "x" }, "k", function()
					cinnamon.scroll("k")
				end)
			end,
		},
	},
})

And i've scrolled with j and k plenty of times through the long lines of this file: https://github.com/NicolasGB/filecrab/blob/main/filecrab-server/src/main.rs

I know it's not the best way to reproduce it, but hopefully it helps.

Let me know if i can provide more information

NicolasGB avatar Jul 25 '24 07:07 NicolasGB

Some flickering is expected when wrap is set. I'm working on a way to get around this without adding a bunch of extra processing for each animation step. For now I've just added a warning about wrap flickering when using :checkhealth cinnamon

declancm avatar Jul 26 '24 23:07 declancm

I've made changes to single line keymaps like j and k to not trigger animation when used without a count which should resolve this

declancm avatar Aug 07 '24 01:08 declancm