lizard-heart / obsidian-to-omnifocus

GNU General Public License v3.0
32 stars 11 forks source link

Duplicated tasks #3

Closed blujaxfan closed 1 year ago

blujaxfan commented 1 year ago

Version 1.1.16 (Installer 1.1.9), MacOS 13.3

I am getting duplicated text if I run the Extract command (Not using selected text, but the whole note). This behavior does not happen if I use the 'selected text' command. To me it appears the modified text is being inserted at the current cursor location, not replaced.

Here is the starting text in the note:

This is not a task

This is not another task This is indented text under not nother task

Here is what is in the note after I run the command

This is not a task

This is not another task This is indented text under not nother task- [x] This is a task #1

This is not a task

This is not another task This is indented text under not nother task

Before After
derrickwheals commented 1 year ago

Same here

lizard-heart commented 1 year ago

Thank you for the issue. I will try to fix this as soon as possible.

gregnewman commented 1 year ago

I'm having the same problem. If I turn off the option to mark complete after creating the tasks in OmniFocus it does not duplicate the page content.

nweisenfeld commented 1 year ago

If I understand it correctly, the issue is really that it uses "replaceSelection" regardless of whether it's operating on the selection or the whole text. What that means is that the error is slightly more odd than just "duplicating" tasks. Instead, the enter text is duplicated, with the tasks marked complete, and written over any selection in the editor.

Note that while I'm a seasoned software engineer, I'm not a Javascript programmer in any way, so please review my PR fully.

Here's a PR to address the issue: #5

lizard-heart commented 1 year ago

Alright, this issue seems to be fixed. Thanks for the pull request. Let me know if anyone here is still having issues.