diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2025-02-21 02:02:32 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2025-02-26 23:06:22 +0100 |
commit | be1fbe38b31b6046d396407c4efbf238941c6b08 (patch) | |
tree | 697a429f5ac903d766c2faaf5044fa7a16eeea77 /test/functional/treesitter/query_spec.lua | |
parent | f4921e2b7deb4812414998a521c33f920f571c20 (diff) | |
download | rneovim-be1fbe38b31b6046d396407c4efbf238941c6b08.tar.gz rneovim-be1fbe38b31b6046d396407c4efbf238941c6b08.tar.bz2 rneovim-be1fbe38b31b6046d396407c4efbf238941c6b08.zip |
feat(lua): vim.text.indent()
Problem:
Indenting text is a common task in plugins/scripts for
presentation/formatting, yet vim has no way of doing it (especially
"dedent", and especially non-buffer text).
Solution:
Introduce `vim.text.indent()`. It sets the *exact* indentation because
that's a more difficult (and thus more useful) task than merely
"increasing the current indent" (which is somewhat easy with a `gsub()`
one-liner).
Diffstat (limited to 'test/functional/treesitter/query_spec.lua')
-rw-r--r-- | test/functional/treesitter/query_spec.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/functional/treesitter/query_spec.lua b/test/functional/treesitter/query_spec.lua index 6db0ffe5a0..be9c60b8ad 100644 --- a/test/functional/treesitter/query_spec.lua +++ b/test/functional/treesitter/query_spec.lua @@ -386,8 +386,8 @@ void ui_refresh(void) [[((primitive_type) @c-keyword (#any-of? @c-keyword "int" "float"))]] ) eq({ - { 'c-keyword', 'primitive_type', { 2, 2, 2, 5 }, 'int' }, - { 'c-keyword', 'primitive_type', { 3, 4, 3, 7 }, 'int' }, + { 'c-keyword', 'primitive_type', { 2, 0, 2, 3 }, 'int' }, + { 'c-keyword', 'primitive_type', { 3, 2, 3, 5 }, 'int' }, }, res0) local res1 = exec_lua( @@ -401,9 +401,9 @@ void ui_refresh(void) ]] ) eq({ - { 'fizzbuzz-strings', 'string_literal', { 6, 15, 6, 38 }, '"number= %d FizzBuzz\\n"' }, - { 'fizzbuzz-strings', 'string_literal', { 8, 15, 8, 34 }, '"number= %d Fizz\\n"' }, - { 'fizzbuzz-strings', 'string_literal', { 10, 15, 10, 34 }, '"number= %d Buzz\\n"' }, + { 'fizzbuzz-strings', 'string_literal', { 6, 13, 6, 36 }, '"number= %d FizzBuzz\\n"' }, + { 'fizzbuzz-strings', 'string_literal', { 8, 13, 8, 32 }, '"number= %d Fizz\\n"' }, + { 'fizzbuzz-strings', 'string_literal', { 10, 13, 10, 32 }, '"number= %d Buzz\\n"' }, }, res1) end) @@ -608,9 +608,9 @@ void ui_refresh(void) eq( { - { 0, 2, 0, 8 }, - { 1, 2, 1, 8 }, - { 2, 2, 2, 8 }, + { 0, 0, 0, 6 }, + { 1, 0, 1, 6 }, + { 2, 0, 2, 6 }, }, test( [[ @@ -636,9 +636,9 @@ void ui_refresh(void) eq( { - { 0, 2, 0, 7 }, - { 1, 2, 1, 8 }, - { 2, 2, 2, 7 }, + { 0, 0, 0, 5 }, + { 1, 0, 1, 6 }, + { 2, 0, 2, 5 }, }, test( [[ @@ -675,9 +675,9 @@ void ui_refresh(void) end) eq({ - { 0, 2, 0, 12 }, - { 1, 2, 1, 12 }, - { 2, 2, 2, 12 }, + { 0, 0, 0, 10 }, + { 1, 0, 1, 10 }, + { 2, 0, 2, 10 }, }, result) end) |