File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,15 @@ local function remove_buffer_empty_lines(opts)
296296 range .end_line = end_line
297297end
298298
299+ --- Checks, if we refile a heading within one file or from one file to another.
300+ --- @param opts CaptureOpts
301+ --- @return boolean
302+ local function check_refile_source (opts )
303+ local source_file = opts .item and opts .item .file or utils .current_file_path ()
304+ local target_file = opts .file
305+ return source_file == target_file
306+ end
307+
299308--- @private
300309--- @param opts CaptureOpts
301310--- @return boolean
@@ -319,8 +328,8 @@ function Capture:_refile_to(opts)
319328 target_line = headline .range .end_line
320329 end
321330
322- local is_same_file = opts .file == utils .current_file_path ()
323331 local item = opts .item
332+ local is_same_file = check_refile_source (opts )
324333 if item and should_adapt_headline then
325334 -- Refiling in same file just moves the lines from one position
326335 -- to another,so we need to apply demote instantly
You can’t perform that action at this time.
0 commit comments