Skip to content

Commit

Permalink
Merge branch 'folke:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dsully authored Jan 8, 2025
2 parents 6134329 + 14e8940 commit bc89cb0
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 10 deletions.
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,61 @@
# Changelog

## [2.12.0](https://github.com/folke/snacks.nvim/compare/v2.11.0...v2.12.0) (2025-01-05)


### Features

* **debug:** system & memory metrics useful for debugging ([cba16bd](https://github.com/folke/snacks.nvim/commit/cba16bdb35199c941c8d78b8fb9ddecf568c0b1f))
* **input:** disable completion engines in input ([37038df](https://github.com/folke/snacks.nvim/commit/37038df00d6b47a65de24266c25683ff5a781a40))
* **scope:** disable treesitter blocks by default ([8ec6e6a](https://github.com/folke/snacks.nvim/commit/8ec6e6adc5b098674c41005530d1c8af126480ae))
* **statuscolumn:** allow changing the marks hl group. Fixes [#390](https://github.com/folke/snacks.nvim/issues/390) ([8a6e5b9](https://github.com/folke/snacks.nvim/commit/8a6e5b9685bb8c596a179256b048043a51a64e09))
* **util:** `Snacks.util.ref` ([7383eda](https://github.com/folke/snacks.nvim/commit/7383edaec842609deac50b114a3567c2983b54f4))
* **util:** throttle ([737980d](https://github.com/folke/snacks.nvim/commit/737980d987cdb4d3c2b18e0b3b8613fde974a2e9))
* **win:** `Snacks.win:border_size` ([4cd0647](https://github.com/folke/snacks.nvim/commit/4cd0647eb5bda07431e125374c1419059783a741))
* **win:** `Snacks.win:redraw` ([0711a82](https://github.com/folke/snacks.nvim/commit/0711a82b7a77c0ab35251e28cf1a7be0b3bde6d4))
* **win:** `Snacks.win:scroll` ([a1da66e](https://github.com/folke/snacks.nvim/commit/a1da66e3bf2768273f1dfb556b29269fd8ba153d))
* **win:** allow setting `desc` for window actions ([402494b](https://github.com/folke/snacks.nvim/commit/402494bdee8800c8ac3eeceb8c5e78e00f72f265))
* **win:** better dimension calculation for windows (use by upcoming layouts) ([cc0b528](https://github.com/folke/snacks.nvim/commit/cc0b52872b99e3af7d80536e8a9cbc28d47e7f19))
* **win:** top,right,bottom,left borders ([320ecbc](https://github.com/folke/snacks.nvim/commit/320ecbc15c25a240fee2c2970f826259d809ed72))


### Bug Fixes

* **dashboard:** hash dashboard terminal section caching key to support long commands ([#381](https://github.com/folke/snacks.nvim/issues/381)) ([d312053](https://github.com/folke/snacks.nvim/commit/d312053f78b4fb55523def179ac502438dd93193))
* **debug:** make debug.inpect work in fast events ([b70edc2](https://github.com/folke/snacks.nvim/commit/b70edc29dbc8c9718af246a181b05d4d190ad260))
* **debug:** make sure debug can be required in fast events ([6cbdbb9](https://github.com/folke/snacks.nvim/commit/6cbdbb9afa748e84af4c35d17fc4737b18638a35))
* **indent:** allow rendering over blank lines. Fixes [#313](https://github.com/folke/snacks.nvim/issues/313) ([766e671](https://github.com/folke/snacks.nvim/commit/766e67145259e30ae7d63dfd6d51b8d8ef0840ae))
* **indent:** better way to deal with `breakindent`. Fixes [#329](https://github.com/folke/snacks.nvim/issues/329) ([235427a](https://github.com/folke/snacks.nvim/commit/235427abcbf3e2b251a8b75f0e409dfbb6c737d6))
* **indent:** breakdinent ([972c61c](https://github.com/folke/snacks.nvim/commit/972c61cc1cd254ef3b43ec1dfd51eefbdc441a7d))
* **indent:** correct calculation of partial indent when leftcol > 0 ([6f3cbf8](https://github.com/folke/snacks.nvim/commit/6f3cbf8ad328d181a694cdded344477e81cd094d))
* **indent:** do animate check in bufcall ([c62e7a2](https://github.com/folke/snacks.nvim/commit/c62e7a2561351c9fe3a8e7e9fc8602f3b61abf53))
* **indent:** don't render scopes in closed folds. Fixes [#352](https://github.com/folke/snacks.nvim/issues/352) ([94ec568](https://github.com/folke/snacks.nvim/commit/94ec5686a64218c9477de7761af4fd34dd4a665b))
* **indent:** off-by-one for indent guide hl group ([551e644](https://github.com/folke/snacks.nvim/commit/551e644ca311d065b3a6882db900846c1e66e636))
* **indent:** repeat_linbebreak only works on Neovim >= 0.10. Fixes [#353](https://github.com/folke/snacks.nvim/issues/353) ([b93201b](https://github.com/folke/snacks.nvim/commit/b93201bdf36bd62b07daf7d40bc305998f9da52c))
* **indent:** simplify indent guide logic and never overwrite blanks. Fixes [#334](https://github.com/folke/snacks.nvim/issues/334) ([282be8b](https://github.com/folke/snacks.nvim/commit/282be8bfa8e6f46d6994ff46638d1c155b90753f))
* **indent:** typo for underline ([66cce2f](https://github.com/folke/snacks.nvim/commit/66cce2f512e11a961a8f187eac802acbf8725d05))
* **indent:** use space instead of full blank for indent offset. See [#313](https://github.com/folke/snacks.nvim/issues/313) ([58081bc](https://github.com/folke/snacks.nvim/commit/58081bcecb31db8c6f12ad876c70786582a7f6a8))
* **input:** change buftype to prompt. Fixes [#350](https://github.com/folke/snacks.nvim/issues/350) ([2990bf0](https://github.com/folke/snacks.nvim/commit/2990bf0c7a79f5780a0268a47bae69ef004cec99))
* **input:** make sure to show input window with a higher zindex of the parent window (if float) ([3123e6e](https://github.com/folke/snacks.nvim/commit/3123e6e9882f178411ea6e9fbf5e9552134b82b0))
* **input:** refactor for win changes and ensure modified=false. Fixes [#403](https://github.com/folke/snacks.nvim/issues/403). Fixes [#402](https://github.com/folke/snacks.nvim/issues/402) ([8930630](https://github.com/folke/snacks.nvim/commit/89306308f357e12510683758c35d08f368db2b2c))
* **input:** use correct highlight group for input prompt ([#328](https://github.com/folke/snacks.nvim/issues/328)) ([818da33](https://github.com/folke/snacks.nvim/commit/818da334ac8f655235b5861bb50577921e4e6bd8))
* **lazygit:** enable boolean values in config ([#377](https://github.com/folke/snacks.nvim/issues/377)) ([ec34684](https://github.com/folke/snacks.nvim/commit/ec346843e0adb51b45e595dd0ef34bf9e64d4627))
* **notifier:** open history window with correct style ([#307](https://github.com/folke/snacks.nvim/issues/307)) ([d2b5680](https://github.com/folke/snacks.nvim/commit/d2b5680359ee8feb34b095fd574b4f9b3f013629))
* **notifier:** rename style `notification.history` -> `notification_history` ([fd9ef30](https://github.com/folke/snacks.nvim/commit/fd9ef30206185e3dd4d3294c74e2fd0dee9722d1))
* **scope:** allow treesitter scopes when treesitter highlighting is disabled. See [#231](https://github.com/folke/snacks.nvim/issues/231) ([58ae580](https://github.com/folke/snacks.nvim/commit/58ae580c2c12275755bb3e2003aebd06d550f2db))
* **scope:** don't expand to invalid range. Fixes [#339](https://github.com/folke/snacks.nvim/issues/339) ([1244305](https://github.com/folke/snacks.nvim/commit/1244305bedb8e60a946d949c78453263a714a4ad))
* **scope:** properly caluclate start indent when `cursor=true` for indent scopes. See [#5068](https://github.com/folke/snacks.nvim/issues/5068) ([e63fa7b](https://github.com/folke/snacks.nvim/commit/e63fa7bf05d22f4306c5fff594d48bc01e382238))
* **scope:** use virtcol for calculating scopes at the cursor ([6a36f32](https://github.com/folke/snacks.nvim/commit/6a36f32eaa7d5d59e681b7b8112a85a58a2d563d))
* **scroll:** check for invalid window. Fixes [#340](https://github.com/folke/snacks.nvim/issues/340) ([b6032e8](https://github.com/folke/snacks.nvim/commit/b6032e8f1b5cba55b5a2cf138ab4f172c4decfbd))
* **scroll:** don't animate when leaving cmdline search with incsearch enabled. Fixes [#331](https://github.com/folke/snacks.nvim/issues/331) ([fc0a99b](https://github.com/folke/snacks.nvim/commit/fc0a99b8493c34e6a930b3571ee8491e23831bca))
* **util:** throttle now autonatically schedules when in fast event ([9840331](https://github.com/folke/snacks.nvim/commit/98403313c749e26e5ae9a8ff51343c97f76ce170))
* **win:** backdrop having bright cell at top right ([#400](https://github.com/folke/snacks.nvim/issues/400)) ([373d0f9](https://github.com/folke/snacks.nvim/commit/373d0f9b6d6d83cdba641937b6303b0a0a18119f))
* **win:** don't enter when focusable is `false` ([ca233c7](https://github.com/folke/snacks.nvim/commit/ca233c7448c930658e8c7da9745e8d98884c3852))
* **win:** force-close any buffer that is not a file ([dd50e53](https://github.com/folke/snacks.nvim/commit/dd50e53a9efea11329e21c4a61ca35ae5122ceca))
* **win:** unset `winblend` when transparent ([0617e28](https://github.com/folke/snacks.nvim/commit/0617e28f8289002310fed5986acc29fde38e01b5))
* **words:** only check modes for `is_enabled` when needed ([80dcb88](https://github.com/folke/snacks.nvim/commit/80dcb88ede1a96f79edd3b7ede0bc41d51dd8a2d))
* **zen:** set zindex to 40, lower than hover (45). Closes [#345](https://github.com/folke/snacks.nvim/issues/345) ([05f4981](https://github.com/folke/snacks.nvim/commit/05f49814f3a2f3ecb83d9e72b7f8f2af40351aad))

## [2.11.0](https://github.com/folke/snacks.nvim/compare/v2.10.0...v2.11.0) (2024-12-15)


Expand Down
2 changes: 1 addition & 1 deletion doc/snacks.nvim.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*snacks.nvim.txt* For Neovim Last change: 2024 December 31
*snacks.nvim.txt* For Neovim Last change: 2025 January 06

==============================================================================
Table of Contents *snacks.nvim-table-of-contents*
Expand Down
1 change: 1 addition & 0 deletions docs/scroll.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Similar plugins:
---@field target vim.fn.winsaveview.ret
---@field scrolloff number
---@field virtualedit? string
---@field changedtick number
```

## 📦 Module
Expand Down
2 changes: 1 addition & 1 deletion lua/snacks/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function M.input(opts, on_confirm)
if opts.icon_pos and (opts.icon or "") ~= "" then
add(opts.icon, "SnacksInputIcon", opts.icon_pos)
end
add(opts.prompt, "SnacksInputBorder", opts.prompt_pos)
add(opts.prompt, "SnacksInputTitle", opts.prompt_pos)

if next(title) then
table.insert(title, { " " })
Expand Down
8 changes: 7 additions & 1 deletion lua/snacks/scroll.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ M.meta = {
---@field target vim.fn.winsaveview.ret
---@field scrolloff number
---@field virtualedit? string
---@field changedtick number

---@class snacks.scroll.Config
---@field animate snacks.animate.Config
Expand Down Expand Up @@ -49,6 +50,9 @@ local spammer_timer = assert((vim.uv or vim.loop).new_timer())
-- get the state for a window.
-- when the state doesn't exist, its target is the current view
local function get_state(win)
if vim.o.paste or vim.fn.reg_executing() ~= "" or vim.fn.reg_recording() ~= "" then
return
end
if not vim.api.nvim_win_is_valid(win) then
return
end
Expand All @@ -59,14 +63,16 @@ local function get_state(win)
if not Snacks.animate.enabled({ buf = buf, name = "scroll" }) then
return
end
local changedtick = vim.api.nvim_buf_get_changedtick(buf)
local view = vim.api.nvim_win_call(win, vim.fn.winsaveview) ---@type vim.fn.winsaveview.ret
if not (states[win] and states[win].buf == buf) then
if not (states[win] and states[win].buf == buf and states[win].changedtick == changedtick) then
---@diagnostic disable-next-line: missing-fields
states[win] = {
win = win,
target = vim.deepcopy(view),
current = vim.deepcopy(view),
buf = buf,
changedtick = changedtick,
}
end
states[win].scrolloff = vim.wo[win].scrolloff
Expand Down
5 changes: 4 additions & 1 deletion lua/snacks/statuscolumn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ function M.setup()
return
end
did_setup = true
Snacks.util.set_hl({
Mark = "DiagnosticHint",
}, { prefix = "SnacksStatusColumn", default = true })
local timer = assert((vim.uv or vim.loop).new_timer())
timer:start(config.refresh, config.refresh, function()
sign_cache = {}
Expand Down Expand Up @@ -122,7 +125,7 @@ function M.buf_signs(buf)
if mark.pos[1] == buf and mark.mark:match("[a-zA-Z]") then
local lnum = mark.pos[2]
signs[lnum] = signs[lnum] or {}
table.insert(signs[lnum], { text = mark.mark:sub(2), texthl = "DiagnosticHint", type = "mark" })
table.insert(signs[lnum], { text = mark.mark:sub(2), texthl = "SnacksStatusColumnMark", type = "mark" })
end
end

Expand Down
12 changes: 6 additions & 6 deletions lua/snacks/win.lua
Original file line number Diff line number Diff line change
Expand Up @@ -875,16 +875,16 @@ function M:dim(parent)
---@param p? number|fun(win:snacks.win):number? pos
---@param s number size
---@param ps number parent size
local function pos(p, s, ps, border_offset)
local function pos(p, s, ps, border_from, border_to)
p = type(p) == "function" and p(self) or p
if not p then -- center
return math.floor((ps - s) / 2) + border_offset
return math.floor((ps - s) / 2) - border_from
end
---@cast p number
if p < 0 then -- negative position
return ps + p - border_offset
return ps - s + p - border_from - border_to
elseif p < 1 and p > 0 then -- relative position
return math.floor(ps * p) + border_offset
return math.floor(ps * p) + border_from
end
return p
end
Expand All @@ -899,8 +899,8 @@ function M:dim(parent)
ret.width = math.max(ret.width, self.opts.min_width or 0, 1)
ret.width = math.min(ret.width, self.opts.max_width or ret.width, parent.width)

ret.row = pos(self.opts.row, ret.height, parent.height, border.top)
ret.col = pos(self.opts.col, ret.width, parent.width, border.left)
ret.row = pos(self.opts.row, ret.height, parent.height, border.top, border.bottom)
ret.col = pos(self.opts.col, ret.width, parent.width, border.left, border.right)

return ret
end
Expand Down

0 comments on commit bc89cb0

Please sign in to comment.