Skip to content

Commit

Permalink
feat: added multiline option back
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent 9cf827d commit d80e978
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/trouble/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ local M = {}
---@field config? fun(opts:trouble.Config)
local defaults = {
debug = false,
multiline = true, -- render multi-line messages
indent_lines = true, -- add an indent guide below the fold icons
max_items = 200, -- limit number of items that can be displayed
events = { "BufEnter" }, -- events that trigger refresh. Also used by auto_open and auto_close
---@type trouble.Window.opts?
---@type trouble.Window.opts
win = {},
throttle = 100,
auto_open = false,
auto_close = false,
auto_preview = true,
---@type trouble.Render.opts
render = {
multiline = true, -- render multi-line messages
-- stylua: ignore
---@type trouble.Indent.symbols
indent = {
Expand Down
6 changes: 6 additions & 0 deletions lua/trouble/view/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

---@class trouble.Text.opts
---@field padding? number
---@field multiline? boolean

---@class trouble.Text
---@field _lines TextSegment[][]
Expand Down Expand Up @@ -56,6 +57,11 @@ function M:append(text, hl, opts)

local nl = text:find("\n", 1, true)
if nl then
if not self.opts.multiline then
text = text:gsub("[\n\r]+", " ")
return self:append(text, hl, opts)
end

local start_col = 0
local last = self._lines[#self._lines]
for _, segment in ipairs(last) do
Expand Down

0 comments on commit d80e978

Please sign in to comment.