🐻 minimal ui2 fuzzy finder for Neovim codeberg.org/comfysage/artio.nvim
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(view): preview window positioning and updating

- check for `winborder = ''`
- update on `win_config`
- offset by `cmdheight + win.height`

robin e75cf833 df21a9b7

+22 -14
+22 -14
lua/artio/view.lua
··· 172 172 end) 173 173 ui2.msg.set_pos() 174 174 end 175 + 176 + if self.preview_win and vim.api.nvim_win_is_valid(self.preview_win) then 177 + vim.api.nvim_win_set_config(self.preview_win, self:previewconfig()) 178 + end 175 179 end 176 180 177 181 ---@param predicted? integer The predicted height of the cmdline window ··· 750 754 return self.picker.preview_item(item.v) 751 755 end 752 756 757 + function View:previewconfig() 758 + local previewopts = self.picker.win.preview_opts 759 + and vim.is_callable(self.picker.win.preview_opts) 760 + and self.picker.win.preview_opts(self) 761 + local cmdheight = vim.api.nvim_win_get_height(ui2.wins.cmd) 762 + 763 + return vim.tbl_extend("force", { 764 + relative = "editor", 765 + width = vim.o.columns, 766 + height = self.win.height, 767 + col = 0, 768 + row = vim.o.lines 769 + - (self.win.height + cmdheight) 770 + - ((vim.o.winborder == "none" or vim.o.winborder == "") and 0 or 2), 771 + }, previewopts or {}) 772 + end 773 + 753 774 function View:updatepreview() 754 775 local buf, on_win = self:openpreview() 755 776 if buf < 0 then ··· 757 778 end 758 779 759 780 if not self.preview_win then 760 - local previewopts = self.picker.win.preview_opts 761 - and vim.is_callable(self.picker.win.preview_opts) 762 - and self.picker.win.preview_opts(self) 763 - self.preview_win = vim.api.nvim_open_win( 764 - buf, 765 - false, 766 - vim.tbl_extend("force", { 767 - relative = "editor", 768 - width = vim.o.columns, 769 - height = self.win.height, 770 - col = 0, 771 - row = vim.o.lines - vim.o.cmdheight * 2 - 1 - (vim.o.winborder == "none" and 0 or 2), 772 - }, previewopts or {}) 773 - ) 781 + self.preview_win = vim.api.nvim_open_win(buf, false, self:previewconfig()) 774 782 else 775 783 vim.api.nvim_win_set_buf(self.preview_win, buf) 776 784 end