Use virtcol for virt_text_win_col

This commit is contained in:
hrsh7th
2021-09-03 19:50:19 +09:00
parent e599f0825c
commit dffe375b4a
2 changed files with 3 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ local cache = require('cmp.utils.cache')
---@field public time number
---@field public mode string
---@field public bufnr number
---@field public virtcol number
---@field public cursor vim.Position|lsp.Position
---@field public cursor_line string
---@field public cursor_after_line string
@@ -52,6 +53,7 @@ context.new = function(prev_context, option)
self.mode = vim.api.nvim_get_mode().mode
self.bufnr = vim.api.nvim_get_current_buf()
self.cursor_line = vim.api.nvim_get_current_line()
self.virtcol = vim.fn.virtcol('.')
self.cursor = {}
self.cursor.row = vim.api.nvim_win_get_cursor(0)[1]
self.cursor.col = vim.api.nvim_win_get_cursor(0)[2] + 1

View File

@@ -65,7 +65,7 @@ core.ghost_text = function(e)
{
virt_text = { { text, 'Comment' } },
virt_text_pos = 'overlay',
virt_text_win_col = ctx.cursor.col - 1,
virt_text_win_col = ctx.virtcol - 1,
hl_mode = 'combine',
priority = 0,
ephemeral = true,