fix(win): correctly deal with initial text containing newlines. Fixes #542

This commit is contained in:
Folke Lemaitre 2025-01-16 22:35:47 +01:00
parent 7c25aec372
commit 825c106f40
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -603,7 +603,7 @@ function M:scratch()
vim.bo[self.buf].swapfile = false
self.scratch_buf = self.buf
local text = type(self.opts.text) == "function" and self.opts.text() or self.opts.text
text = type(text) == "string" and { text } or text
text = type(text) == "string" and vim.split(text, "\n") or text
if text then
---@cast text string[]
vim.api.nvim_buf_set_lines(self.buf, 0, -1, false, text)