summaryrefslogtreecommitdiff
path: root/lua/telescope/pickers.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-03 11:59:51 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-03 11:59:51 -0400
commit1ce5eaad7ada8627910d32a1a2daab184e6419e6 (patch)
tree431ccf33691f1373b1a4b788b07f60511dfd79cb /lua/telescope/pickers.lua
parentb04ec331c48a1668b0df21f24e9870acccec5e64 (diff)
fix: Prevent people from erroring from having new lines in display
Diffstat (limited to 'lua/telescope/pickers.lua')
-rw-r--r--lua/telescope/pickers.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index b072f90..ec515c4 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -259,7 +259,14 @@ function Picker:find()
display = ' ' .. display
-- log.info("Setting row", row, "with value", entry)
- vim.api.nvim_buf_set_lines(results_bufnr, row, row + 1, false, {display})
+ local set_ok = pcall(vim.api.nvim_buf_set_lines, results_bufnr, row, row + 1, false, {display})
+
+ -- This pretty much only fails when people leave newlines in their results.
+ -- So we'll clean it up for them if it fails.
+ if not set_ok then
+ display = display:gsub("\n", " | ")
+ vim.api.nvim_buf_set_lines(results_bufnr, row, row + 1, false, {display})
+ end
end
))