From 66441e549d5c560f8b1d6d6b6e71244ce3569604 Mon Sep 17 00:00:00 2001 From: Maria Solano Date: Fri, 24 Jul 2026 00:52:19 -0700 Subject: [PATCH] fix(text): validate `opts.expandtab` in `vim.text.indent()` #40936 --- runtime/lua/vim/text.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/runtime/lua/vim/text.lua b/runtime/lua/vim/text.lua index 736c5b8e7f..ba038bacf8 100644 --- a/runtime/lua/vim/text.lua +++ b/runtime/lua/vim/text.lua @@ -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.