Skip to content

Commit c8e3d6c

Browse files
fix(files): Handle empty line on Neovim 0.12.3 in set_text
1 parent 215cb47 commit c8e3d6c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lua/orgmode/files/file.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local Footnote = require('orgmode.objects.footnote')
1111
local Memoize = require('orgmode.utils.memoize')
1212
local Buffers = require('orgmode.state.buffers')
1313

14-
local is_nightly = vim.fn.has('nvim-0.13') == 1
14+
local clean_empty_line = vim.fn.has('nvim-0.13') == 1 or vim.fn.has('nvim-0.12.3') == 1
1515

1616
---@class OrgFileMetadata
1717
---@field mtime number File modified time in nanoseconds
@@ -503,7 +503,7 @@ function OrgFile:get_node_text(node, range)
503503

504504
local _, _, _, end_col = node:range()
505505
local text = ts.get_node_text(node, self:get_source(), opts)
506-
if is_nightly and end_col == 0 and text:sub(-1) == '\n' then
506+
if clean_empty_line and end_col == 0 and text:sub(-1) == '\n' then
507507
return text:sub(1, -2)
508508
end
509509
return text

0 commit comments

Comments
 (0)