Fix filetree collapses items when document name changes
With the following dir structure:
main
|-cpp
| |-main.cpp
|-cxx
| |-main.cpp
|-a.cpp
- first open cpp/main.cpp
- then open a.cpp
- then open cxx/main.cpp
The filetree will collapse cpp/main.cpp node. This happens because there is a name change (because KTextEditor tries to deduplicate doc names). On name change we reinsert the changed item.
Previous logic removed the parent prior to reinsertion, the new logic removes the parent after insertion. This allows us to retain expansion state if the item is inserted to the same parent.
Edited by Waqar Ahmed