diff options
| author | kiyan <yazdani.kiyan@protonmail.com> | 2021-03-13 01:01:50 +0100 |
|---|---|---|
| committer | Kiyan <yazdani.kiyan@protonmail.com> | 2021-04-01 20:50:25 +0200 |
| commit | 0f9bdb0939db0e73daacaef78c5ff16bd76f9e81 (patch) | |
| tree | f831ccd4382ac2fae512eca3ad621f0c089820cf /lua/nvim-treesitter/indent.lua | |
| parent | 8948c331ee1247c100c8f1eb9221a0dc7d03eac5 (diff) | |
fix: avoid infinite loop which causes some breakage
Diffstat (limited to 'lua/nvim-treesitter/indent.lua')
| -rw-r--r-- | lua/nvim-treesitter/indent.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua index 083aab17..f89c9476 100644 --- a/lua/nvim-treesitter/indent.lua +++ b/lua/nvim-treesitter/indent.lua @@ -67,7 +67,7 @@ function M.get_indent(lnum) if prevnonblank ~= lnum then local prev_node = get_node_at_line(root, prevnonblank-1) -- get previous node in any case to avoid erroring - while not prev_node do + while not prev_node and prevnonblank-1 > 0 do prevnonblank = vim.fn.prevnonblank(prevnonblank-1) prev_node = get_node_at_line(root, prevnonblank-1) end |
