Skip to content

Commit 483b401

Browse files
authored
Merge pull request #4 from lyz-code/fix/refile-last-version
fix: make refile work with the latest version of orgmode
2 parents 2dc1466 + d43a9c1 commit 483b401

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lua/telescope/_extensions/orgmode/refile_heading.lua

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,14 @@ return function(opts)
3232
local dst_headline = entry.value.headline
3333
if dst_headline then
3434
-- NOTE: adapted from Capture:refile_to_headline
35-
if src_item and src_item.level <= dst_headline.level then
36-
-- Refiling in same file just moves the lines from one position
37-
-- to another,so we need to apply demote instantly
38-
local is_same_file = dst_file.filename == src_item.root.filename
39-
src_lines = src_item:demote(dst_headline.level - src_item.level + 1, true, not is_same_file)
40-
end
41-
refile_opts = {
35+
local is_same_file = dst_file.filename == src_item.root.filename
36+
src_lines = Capture:_adapt_headline_level(src_item, dst_headline.level, is_same_file)
37+
local refile_opts = {
4238
file = dst_file.filename,
4339
lines = src_lines,
4440
item = src_item,
4541
range = Range.from_line(dst_headline.position.end_line),
46-
headline = dst_headline.position.end_line,
42+
headline = dst_headline.title,
4743
}
4844
local refiled = Capture:_refile_to(refile_opts)
4945
if not refiled then

0 commit comments

Comments
 (0)