Shougo/ddu-ui-filer

preview window doesn't redraw in `redraw` action

Closed this issue · 2 comments

Warning: I will close the issue without the minimal init.vim and the
reproduction instructions.

Problems summary

SSIA

Expected

ddu window and preview window are both updated and redraw.

Environment Information

  • ddu-ui-filer version (SHA1):
    ee7b69d
  • denops.vim version (SHA1):
    16d4bbc
  • deno version(deno -V output):
    deno 1.38.5
  • OS:
    WSL2 Ubuntu 22.04.3
  • neovim/Vim :version output:
    NVIM v0.10.0-dev-1846+gf31f260f0
    Build type: RelWithDebInfo
    LuaJIT 2.1.1702233742

Provide a minimal init.vim/vimrc without plugin managers (Required!)

vim.opt.rtp:append("~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim")
vim.opt.rtp:append("~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim")
vim.opt.rtp:append("~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-filer")
vim.opt.rtp:append("~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-file")
vim.opt.rtp:append("~/.cache/dein/nvim/repos/github.com/Shougo/ddu-kind-file")

local function set_filer_layout()
	vim.fn["ddu#custom#patch_local"]("default", {
		uiParams = {
			filer = {
				split = "floating",
				winRow = 1,
				winCol = 1,
				winWidth = "&columns / 2",
				winHeight = "&lines",
				previewFloating = true,
				previewRow = 1,
				previewCol = "&columns / 2",
				previewWidth = "&columns / 2",
				previewHeight = "&lines",
			}
		}
	})
end

set_filer_layout()

local function update_ui_layout()
	local currentOptions = vim.fn["ddu#custom#get_current"]()
	if vim.tbl_isempty(currentOptions) then
		return
	end
	local updatedLocalOptions = vim.fn["ddu#custom#get_local"]()
	if vim.tbl_isempty(updatedLocalOptions) then
		return
	end
	vim.fn["ddu#ui#do_action"]('updateOptions', updatedLocalOptions[currentOptions["name"]])
	vim.fn["ddu#ui#do_action"]('redraw', { method = "uiRedraw" })
end

vim.api.nvim_create_autocmd("VimResized", {
	pattern = "*",
	callback = function()
		set_filer_layout()
		update_ui_layout()
	end
})

vim.keymap.set('n', '<Space>e', function ()
	vim.fn["ddu#start"]({
		ui = "filer",
		sources = { "file" }
	})
end)

vim.api.nvim_create_autocmd("FileType", {
	pattern = "ddu-filer",
	callback = function()
		vim.keymap.set('n', 'p', function ()
			vim.fn["ddu#ui#do_action"]('preview')
		end)
		vim.keymap.set('n', 'q', function ()
			vim.fn["ddu#ui#do_action"]('quit')
		end)
	end
})

How to reproduce the problem from neovim/Vim startup (Required!)

  1. type <Space> e to start ddu
  2. type p on ddu window to start preview
  3. change the vim window size to fire VimResized autocmd
  4. the preview window size does not changed...

Screenshot (if possible)

hoge

Upload the log messages by :redir and :message (if errored)

Please don't use Lua. I don't want to debug Lua script.

Sorry. Current preview feature does not support redraw.
If you want to redraw preview window, you need to both UI actions closePreviewWindow and preview again.