Fix #703
This commit is contained in:
@@ -180,4 +180,27 @@ misc.deprecated = function(fn, msg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Redraw
|
||||||
|
misc.redraw = setmetatable({
|
||||||
|
doing = false,
|
||||||
|
force = false,
|
||||||
|
}, {
|
||||||
|
__call = function(self, force)
|
||||||
|
if self.doing then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.doing = true
|
||||||
|
self.force = not not force
|
||||||
|
vim.schedule(function()
|
||||||
|
if self.force then
|
||||||
|
vim.cmd([[redraw!]])
|
||||||
|
else
|
||||||
|
vim.cmd([[redraw]])
|
||||||
|
end
|
||||||
|
self.doing = false
|
||||||
|
self.force = false
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
return misc
|
return misc
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ window.update = function(self)
|
|||||||
-- In cmdline, vim does not redraw automatically.
|
-- In cmdline, vim does not redraw automatically.
|
||||||
if api.is_cmdline_mode() then
|
if api.is_cmdline_mode() then
|
||||||
vim.api.nvim_win_call(self.win, function()
|
vim.api.nvim_win_call(self.win, function()
|
||||||
vim.cmd([[redraw]])
|
misc.redraw()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ local window = require('cmp.utils.window')
|
|||||||
local config = require('cmp.config')
|
local config = require('cmp.config')
|
||||||
local types = require('cmp.types')
|
local types = require('cmp.types')
|
||||||
local keymap = require('cmp.utils.keymap')
|
local keymap = require('cmp.utils.keymap')
|
||||||
|
local misc = require('cmp.utils.misc')
|
||||||
local api = require('cmp.utils.api')
|
local api = require('cmp.utils.api')
|
||||||
|
|
||||||
local SIDE_PADDING = 1
|
local SIDE_PADDING = 1
|
||||||
@@ -221,7 +222,7 @@ custom_entries_view.draw = function(self)
|
|||||||
|
|
||||||
if api.is_cmdline_mode() then
|
if api.is_cmdline_mode() then
|
||||||
vim.api.nvim_win_call(self.entries_win.win, function()
|
vim.api.nvim_win_call(self.entries_win.win, function()
|
||||||
vim.cmd([[redraw]])
|
misc.redraw()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
local config = require('cmp.config')
|
local config = require('cmp.config')
|
||||||
|
local misc = require('cmp.utils.misc')
|
||||||
local str = require('cmp.utils.str')
|
local str = require('cmp.utils.str')
|
||||||
local types = require('cmp.types')
|
local types = require('cmp.types')
|
||||||
local api = require('cmp.utils.api')
|
local api = require('cmp.utils.api')
|
||||||
@@ -81,7 +82,7 @@ ghost_text_view.show = function(self, e)
|
|||||||
self.win = vim.api.nvim_get_current_win()
|
self.win = vim.api.nvim_get_current_win()
|
||||||
self.entry = e
|
self.entry = e
|
||||||
if changed then
|
if changed then
|
||||||
vim.cmd([[redraw!]]) -- force invoke decoration provider.
|
misc.redraw(true) -- force invoke decoration provider.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -89,7 +90,7 @@ ghost_text_view.hide = function(self)
|
|||||||
if self.win and self.entry then
|
if self.win and self.entry then
|
||||||
self.win = nil
|
self.win = nil
|
||||||
self.entry = nil
|
self.entry = nil
|
||||||
vim.cmd([[redraw!]]) -- force invoke decoration provider.
|
misc.redraw(true) -- force invoke decoration provider.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user