jceb / vim-orgmode

Text outlining and task management for Vim based on Emacs' Org-Mode
http://www.vim.org/scripts/script.php?script_id=3642
Other
3.1k stars 266 forks source link

Demoting a header/subtree "corrupts" org file (duplicates children) #340

Open doak opened 4 years ago

doak commented 4 years ago

Demoting a header or subtree (either with <<, <ah or <ar) causes under certain conditions the subtree to be duplicated at wrong place.

Consider this example:

* LEVEL 0
* LEVEL 1
** LEVEL 1.1
*** LEVEL 1.1.1
*** LEVEL 1.1.2
** LEVEL 1.2
*** LEVEL 1.2.1
*** LEVEL 1.2.2
* LEVEL 2
** LEVEL 2.1
** LEVEL 2.2
* LEVEL 3

Demoting subtree LEVEL 1.1 should IMHO result in:

* LEVEL 0
* LEVEL 1
* LEVEL 1.1
** LEVEL 1.1.1
** LEVEL 1.1.2
** LEVEL 1.2
*** LEVEL 1.2.1
*** LEVEL 1.2.2
* LEVEL 2
** LEVEL 2.1
** LEVEL 2.2
* LEVEL 3

... but it results in:

** LEVEL 1.2
*** LEVEL 1.2.1
*** LEVEL 1.2.2
* LEVEL 0
* LEVEL 1
* LEVEL 1.1
** LEVEL 1.1.1
** LEVEL 1.1.2
** LEVEL 1.2
*** LEVEL 1.2.1
*** LEVEL 1.2.2
* LEVEL 2
** LEVEL 2.1
** LEVEL 2.2
* LEVEL 3

Hence, the first three lines had been duplicated. Furthermore the cursor is located at these lines as well.

There are several closed issues in this context (#217, #27, #2), perhaps this is caused by one of the corresponding fixes.

I am using current master (v0.6.0-28-gc6cd668).