chhoumann / quickadd

QuickAdd for Obsidian
https://quickadd.obsidian.guide
MIT License
1.44k stars 134 forks source link

[BUG] "Insert at end of section" option in Capture event is disregarded. #677

Open BugCatcher91 opened 2 months ago

BugCatcher91 commented 2 months ago

Describe the bug "Insert at end of section" option in Capture event is ignored when the specified heading also contains sub-sections.

To Reproduce Steps to reproduce the behavior (Source mode and line numbers enabled for visibility):

  1. Create a new note file with 1 heading titled H1 and a sub-heading labelled H2. image
  2. Create a new QuickAdd Capture titled "End of H1" with settings as shown. image image
  3. Run QuickAdd: "End of H1" from the Command Palette and enter value "1" in the prompt modal. image image
  4. Note "1" is inserted at the end of sub-section H2 (rather than H1). image
  5. Run QuickAdd: "End of H1" again from the Command Palette and enter value "2" in the prompt modal. image
  6. Note that the second value entered ("2") is placed above the first value ("1") in sub-section H2, rather than at the end of section H1. image

Extra weird behavior: the presence of properties will change the above outcome.

  1. Repeat steps 1-6 on new note file which has properties (i.e. "tags" field).
  2. Note the entered values now are correctly placed in section H1, although the are still incorrectly placed at the start of the section, rather than the end (evidenced by "2" appearing above "1"). image

Expected behavior Entered values should be placed at the end of the specified section (i.e. H1) and ultimately appear in the same order as they were entered (i.e. 1 followed by 2), as shown:

Without properties image

With properties image

Screenshots See above.

Desktop (please complete the following information):

Smartphone (please complete the following information):