Skip to content

Commit

Permalink
fix: handle line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
igorlfs authored and theHamsta committed Jul 2, 2024
1 parent 1f3dcd6 commit 484995d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ require("nvim-dap-virtual-text").setup {
--- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text
--- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed
display_callback = function(variable, buf, stackframe, node, options)
-- by default, strip out new line characters
if options.virt_text_pos == 'inline' then
return ' = ' .. variable.value
return ' = ' .. variable.value:gsub("%s+", " ")
else
return variable.name .. ' = ' .. variable.value
return variable.name .. ' = ' .. variable.value:gsub("%s+", " ")
end
end,
-- position of virtual text, see `:h nvim_buf_set_extmark()`, default tries to inline the virtual text. Use 'eol' to set to end of line
Expand Down
5 changes: 3 additions & 2 deletions lua/nvim-dap-virtual-text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ local options = {
--- @return string|nil text how the virtual text should be displayed or nil, if this variable shouldn't be displayed
--- @diagnostic disable-next-line: unused-local
display_callback = function(variable, buf, stackframe, node, options)
-- by default, strip out new line characters
if options.virt_text_pos == 'inline' then
return ' = ' .. variable.value
return ' = ' .. variable.value:gsub('%s+', ' ')
else
return variable.name .. ' = ' .. variable.value
return variable.name .. ' = ' .. variable.value:gsub('%s+', ' ')
end
end,
}
Expand Down

0 comments on commit 484995d

Please sign in to comment.