diff options
| author | Michael Lan <michaellan202@gmail.com> | 2022-02-02 12:45:51 -0800 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-02-03 08:38:50 +0100 |
| commit | 50cf31065c1e3502d8964bb3674b95567d752074 (patch) | |
| tree | a9b50e94ee483879e0fed22e7aa94f4dec797600 /lua | |
| parent | Update lockfile.json (#2434) (diff) | |
| download | nvim-treesitter-50cf31065c1e3502d8964bb3674b95567d752074.tar nvim-treesitter-50cf31065c1e3502d8964bb3674b95567d752074.tar.gz nvim-treesitter-50cf31065c1e3502d8964bb3674b95567d752074.tar.bz2 nvim-treesitter-50cf31065c1e3502d8964bb3674b95567d752074.tar.lz nvim-treesitter-50cf31065c1e3502d8964bb3674b95567d752074.tar.xz nvim-treesitter-50cf31065c1e3502d8964bb3674b95567d752074.tar.zst nvim-treesitter-50cf31065c1e3502d8964bb3674b95567d752074.zip | |
fix(utils): adjust truncation condition
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-treesitter/ts_utils.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/nvim-treesitter/ts_utils.lua b/lua/nvim-treesitter/ts_utils.lua index 06b43ce4c..5b7023c57 100644 --- a/lua/nvim-treesitter/ts_utils.lua +++ b/lua/nvim-treesitter/ts_utils.lua @@ -22,7 +22,7 @@ function M.get_node_text(node, bufnr) local lines = api.nvim_buf_get_lines(bufnr, start_row, end_row + 1, false) lines[1] = string.sub(lines[1], start_col + 1) -- end_row might be just after the last line. In this case the last line is not truncated. - if #lines == end_row - start_row then + if #lines == end_row - start_row + 1 then lines[#lines] = string.sub(lines[#lines], 1, end_col) end return lines |
