fix: 修复了英文空白符号匹配的bug

This commit is contained in:
JuanZoran
2023-01-16 12:10:09 +08:00
parent 0ca9710061
commit 5a84b95301
4 changed files with 24 additions and 25 deletions

View File

@ -49,6 +49,7 @@ function M:alloc_block(s_row, s_col, height, width)
})
end
function M:alloc_items()
local items = {}
local width = 0 -- 所有item的总width
@ -62,20 +63,19 @@ function M:alloc_items()
end,
load = function()
self.len = self.len + 1
local l = self.len + 1
local space = math.floor((self.width - width) / (size - 1))
assert(space > 0)
local interval = (' '):rep(space)
local value = ''
local function load_item(index)
if items[index][2] then
table.insert(self.highlights[self.len], {
table.insert(self.highlights[l], {
name = items[index][2],
_start = #value,
_end = #value + #items[index][1],
})
end
value = value .. items[index][1]
end
@ -85,7 +85,8 @@ function M:alloc_items()
load_item(i)
end
self.lines[self.len] = value
self.lines[l] = value
self.len = l
end
}
end

View File

@ -135,7 +135,7 @@ M.hover = {
expl(content, '英文注释')
vim.tbl_map(function(def)
def = def:gsub('%s+', '', 1) -- TODO :判断是否需要分割空格
def = def:gsub('^%s+', '', 1) -- TODO :判断是否需要分割空格
content:addline(indent .. def, 'TransDefinition')
end, vim.split(indent .. result.definition, '\n', { plain = true, trimempry = true }))