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)
296
296
range .end_line = end_line
297
297
end
298
298
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
+
299
308
--- @private
300
309
--- @param opts CaptureOpts
301
310
--- @return boolean
@@ -319,8 +328,8 @@ function Capture:_refile_to(opts)
319
328
target_line = headline .range .end_line
320
329
end
321
330
322
- local is_same_file = opts .file == utils .current_file_path ()
323
331
local item = opts .item
332
+ local is_same_file = check_refile_source (opts )
324
333
if item and should_adapt_headline then
325
334
-- Refiling in same file just moves the lines from one position
326
335
-- to another,so we need to apply demote instantly
You can’t perform that action at this time.
0 commit comments