long line improvement

mine
ray-x 2 years ago
parent 927c464b70
commit fb87a0b1b7

@ -155,9 +155,13 @@ function M.prepare_for_render(items, opts)
end
if #ts_report > 1 then
space, trim = get_pads(win_width, item.text, ts_report)
local l = math.max(20, opts.width - math.min(20, #ts_report))
if trim and #item.text < l then
trim = false
end
if trim then
local ts_r = ts_report or ''
item.text = string.sub(item.text, 1, math.max(1, opts.width - math.max(20, #ts_r)))
item.text = string.sub(item.text, 1, l)
local _, j = string.gsub(item.text, [["]], '')
if j % 2 == 1 then
item.text = item.text .. '"'

@ -193,7 +193,7 @@ function M.ref_context(opts)
local text = table.concat(lines, separator)
local text_len = #text
if text_len > indicator_size then
return "..." .. text:sub(text_len - indicator_size, text_len)
return '' .. text:sub(text_len - indicator_size, text_len)
end
return text

Loading…
Cancel
Save