dotfiles
bugabingas dorkfiles
owned by bugabinga
debug(cmdline): add file logging for Path B virt_lines
f45eeb5375384cc62665328ef0954eae2bca00d2
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
Browse filesCompare with HEAD
Changed files (1)
neovim/lua/bugabinga/cmdline/render.lua
Modified 1 +local dbg_file
= io.
open(
'/tmp/cmdline_debug.log',
'a')
2 +local function dbg(
...)
5 + for i, v
in ipairs(args)
do 6 + parts[i]
= vim.inspect(v)
8 + local line
= os.
date '%H:%M:%S' .. ' ' .. table.
concat(parts,
' ')
9 + dbg_file:write(line
.. '\n')
1 13 local format
= require 'bugabinga.cmdline.format' 2 14 local position
= require 'bugabinga.cmdline.position' 3 15 local cursor
= require 'bugabinga.cmdline.cursor' 107 119 local prompt_is_single_line
= not prompt:match
'\n' 108 120 local prompt_fits
= vim.fn.strdisplaywidth(prompt)
<= max_prompt_width
109 121 if prompt_is_single_line
and prompt_fits
then 122 + dbg(
'Path A', {
prompt = prompt,
prompt_fits = prompt_fits,
max_prompt_width = max_prompt_width })
110 123 local title_text
= ' ' .. prompt
.. ' ' 111 124 vim.api.nvim_win_set_config(win, {
112 125 border = vim.g.border_style,
117 130 local prompt_chunks
= format.prompt_lines(prompt, max_prompt_width)
131 + dbg(
'Path B debug', {
133 + prompt_chunks = prompt_chunks,
134 + max_prompt_width = max_prompt_width,
135 + prompt_width = vim.fn.strdisplaywidth(prompt),
118 137 local virt_line_tuples
= {}
119 138 for _, chunk
in ipairs(prompt_chunks)
do 120 139 table.
insert(virt_line_tuples, { { chunk,
'Question' } })
122 - vim.api.nvim_buf_set_extmark(buf, prompt_ns,
0,
0, {
141 + dbg(
'virt_line_tuples', virt_line_tuples)
142 + local extmark_result
= vim.api.nvim_buf_set_extmark(buf, prompt_ns,
0,
0, {
123 143 virt_lines = virt_line_tuples,
124 144 virt_lines_above =
true,
146 + dbg(
'extmark_result', extmark_result)
126 147 vim.api.nvim_win_set_config(win, {
127 148 border = vim.g.border_style,
128 149 title = { {
' ',
'Normal' } },