fix(text): validate opts.expandtab in vim.text.indent() #40936

This commit is contained in:
Maria Solano
2026-07-24 00:52:19 -07:00
committed by GitHub
parent e4137a7324
commit 66441e549d

View File

@@ -160,9 +160,12 @@ end
function M.indent(size, text, opts)
vim.validate('size', size, 'number')
vim.validate('text', text, 'string')
vim.validate('opts', opts, 'table', true)
-- TODO(justinmk): `opts.prefix`, `predicate` like python https://docs.python.org/3/library/textwrap.html
vim.validate('opts', opts, 'table', true)
opts = opts or {}
vim.validate('opts.expandtab', opts.expandtab, 'number', true)
local tabspaces = opts.expandtab and (' '):rep(opts.expandtab) or nil
--- Minimum common indent shared by all lines.