#1765 CtagsSideKick does not update tags correctly in some circumstances


Requested to separate the two plugins into two bugs.
Text copied over from 1764:

Somewhere along the way (recently) the ctags interface has grown an issue.

Just reproduced this with:
jEdit 5.2pre1 - daily downloaded 11/5/2013
Windows 7 Enterprise SP1
Java 1.7.0_45

Start with a fresh settings directory
Install plugins CtagsInterface, CtagsSideKick, ProjectViewer (and those dependencies automatically selected) from Plugin Manager
Set the Ctags path in both CtagsInterface and CtagsSideKick plugin settings
Set CtagsInteface tag preview dockable to follow caret
Create a project and add all files (I used the ctags source directory)
Add the project to the tags database by right clicking in Project Viewer
Open a source file (I used c.c)
Dock SideKick and Tag Preview where they are visible (I chose left and bottom, respectively)
Click on a tagged value (like KEYWORD_BOOLEAN for example)
Observe that both the sidekick and tag preview dockables show the correct tag & line
Add a few blank lines above the tag and save the source file

Problem 1 - the index was not updated like it should have been, as the default for CtagsInterface is to update on save. (Check the touch time on the tags file, or just grep for a tag in the file to prove it still points to the old location.)

Problem 2 - CtagsSideKick now thinks you are pointing to a different tag. Click on the same tag word in the source file as before (KEYWORD_BOOLEAN for example) and observe that the SideKick dockable thinks you are pointing to a different tag (KEYWORD_DOUBLE for me, which happens to be exactly five lines below KEYWORD_BOOLEAN, and I added five lines.)

Force the SideKick to update by clicking the refresh button in the dockable and it will be back in sync.

Now force the tags file to update by selecting Update project in tag index from the context menu in Project Viewer.

Problem 3 - Observe in the Tag Preview that the tag now appears to be found twice in each file that it really appears in, once at the old location (clicking on this line of the preview dockable will take you to the wrong line) and once at the correct new location.

If you then add a couple more blank lines, save, and for a re-index, you will now see a 3rd entry in the Tag Preview.

There is really only one entry in the tags file, which you can prove by grepping the tags file, and it appears to have been updated to the new location, so it seems that the CtagsInterface is keeping its own private copy, and only adding the new location to the list during the update.

If you now Remove project from tag index, and re-add it, everything goes back to working, with both SideKick and Tag Preview agreeing with the one and only correct location for the tag... until you edit the file again.