File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
lua/telescope/_extensions/orgmode Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments