XML tools 2.4.x place the caret always at position 0 while changing the active tab
A plugin to improve Notepad++
Brought to you by:
jenslorenz
I've most recently updated the XML tools from a version 2.3.x to 2.4.6.
Since that version there is a bug on every opened document in Notepad++:
When you change the active tab, then the caret is always placed at position 0. If I remove the XML tools plugin then that behaviour is gone, so this bug comes from the XML tools plugin and not from Notepad++ itself.
This is very nasty, because I often change the active document to compare texts. So I must remove the XML tools plugin, so I could work again properly.
Kind Regards
David Gausmann
I'm seeing the exact same behavior. This is rather catastrophic behavor.
I’m experiencing the same issue after updating to version 2.4.6.
I played with the ‘XML Tools’ options and by un-checking the “Set XML type automatically” in the menu, the issue went away. Checking it again brings back the issue.
I hope this temporary solution helps people to keep using this plugin till the developer(s) will fix this issue.
I also hope that it will help the developer(s) to locate more easily the error in the source code.
Best Regards,
Zoltan Gal-Bancsi
This bug is a well known which was unfortunately introduced with version 2.4.4. But it was fixed in version 2.4.5 and I couldn't notice any regression in following releases. So it's very strange that you experience it in version 2.4.6.
Disabling the "Set XML type automatically" option in XMLTools is currently the only good alternative which solves the issue.
I'll try to reproduce the problem on my system but for the moment I cannot, and all tests I perform are OK. Please can you tell which NPP version you use and which other plugins do you have on your system ?
Thanks
Thank you for your quick feedback!
Here are the information you have requested:
NPP v6.7.8.2 (latest)
Plugins: AnalysePlugin, Compare, Converter, DSpellCheck, HTML Tag, Light Explorer, MathPad, MIME Tools, Notepad++ plugin demo, NppAStyle, NppCalc, NppCrypt, NppExec, NppExport, NppFTP, Plugin Manager, PyNPP, Python Script, Save as admin, Spell-Checker, TextFX Characters, ToolBucket, XML Tools.
All plugins updated to the latest versions.
Last update I made updated the following plugins only: DSpellCheck, NppCalc, NppExec, NppFTP, PyNPP, XML Tools.
This was the moment when I encountered the issue in discussion. I disabled all updated plugins, then enabled them one by one, this is how I found that the issue is coming from the XML Tools plugin.
Hi,
I definitively don't have same behaviour on my environment :'( It's very frustrating because I cannot fix the problem and I can't even figure what the root cause could be.
So I've build a debug version of pre-version 2.4.7 which dumps some internal variables into a debug window. Debug version is available here:
http://sourceforge.net/projects/npp-plugins/files/XML%20Tools/temp/debug.rar/download
Could you please try to reproduce the issue on your environment with this version and send me back the full dump ? Maybe this will help me solving the issue.
Thanks a lot
Best Regards
Here is my debug trace.
I've added lines starting/ending with -- so you can see where my user action was.
-- Program Start --
XML Tools plugin
version 2.4.7
libXML: 2.9.2
libXSLT: 1.1.28
Locating XMLToolsExt.ini... C:\Users\Joe\AppData\Roaming\Notepad++\XMLToolsExt.ini
Loading libraries... OK
Initialization finished.
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 1
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 2
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 3
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 4
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 5
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 6
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 7
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 8
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 9
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 10
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 11
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 12
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 13
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 14
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 15
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 16
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 16
Current langtype: 0
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 15
Current langtype: 0
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 14
Current langtype: 0
setAutoXMLType()
NPP Event: NPPN_READY
checkUpdates()
NPP Event: NPPN_FILEBEFORESAVE
-- change from first tab to other tab --
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 13
Current langtype: 1
setAutoXMLType()
-- change back to previous tab, now the position is at the top --
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 12
Current langtype: 0
setAutoXMLType()
Kind Regards
David Gausmann
I can also confirm that disabling "set XML type automatically" resolves the problem. Here's my similar debug log. I also have quite a lot of tabs open.
XML Tools plugin
version 2.4.7
libXML: 2.9.2
libXSLT: 1.1.28
Locating XMLToolsExt.ini... C:\Rob\Utils\Notepad++\XMLToolsExt.ini
Loading libraries... OK
Initialization finished.
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 1
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 2
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 3
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 4
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 5
... removed for brevity - but this was just all the rest of the file opens ...
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 41
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 42
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 43
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 43
Current langtype: 0
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 42
Current langtype: 0
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 41
Current langtype: 17
setAutoXMLType()
NPP Event: NPPN_READY
checkUpdates()
NPP Event: NPPN_FILEBEFORESAVE
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 40
Current langtype: 17
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 39
Current langtype: 17
... here, I turned off the "set XML type automatically" ...
... at this point, the selection status is properly saved between tab changes ...
setAutoXMLType()
insertAutoXMLType()
savePluginParams()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 38
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 37
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 36
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 35
... now, I turned back on the "set XML type automatically" ...
... and the caret and selection is lost between tab changes ...
insertAutoXMLType()
savePluginParams()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 34
Current langtype: 17
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 33
Current langtype: 17
Ok... Just for kicks, I tried it with only 2 txt files, and the bug goes away. The following is with "set XML type automatically" ENABLED, yet the selection is properly maintained between tab switches.
XML Tools plugin
version 2.4.7
libXML: 2.9.2
libXSLT: 1.1.28
Locating XMLToolsExt.ini... C:\Rob\Utils\Notepad++\XMLToolsExt.ini
Loading libraries... OK
Initialization finished.
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 1
NPP Event: NPPN_FILEOPENED
enableBufferActivated: 2
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 2
Current langtype: 0
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 1
Current langtype: 0
setAutoXMLType()
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_READY
checkUpdates()
NPP Event: NPPN_FILEBEFORESAVE
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
NPP Event: NPPN_BUFFERACTIVATED
enableBufferActivated: 0
Last edit: Rob Kodey 2015-06-03
Thanks for feedbacks.
I suspect two causes:
One more issue is the fact that xmltools force caret to position 0 after changing language.
So, I've build a new release which don't try to set XML type for all open files, but only for the active tab. I also remove the caret pos forcing. Can you test this new release please ?
http://sourceforge.net/projects/npp-plugins/files/XML%20Tools/temp/XMLTools%202.4.7%20alpha.rar/download
Thanks for your support
Best Regards
I've tested the new dll and the bug seems to be away. :)
Furthermore I've removed all of my other plugins and tested the old version of the plugin.
The bug did still occur with the old version so there was no interference with other plugins.
With the old plugin the bug did only occur if the file had an other language than "xml" and didn't start with "<?xml". So your second cause seems to be the one...
But however the bug seems to be away with the new dll, so you are on the right way!
Kind Regards
David Gausmann
Your sentence “One more issue is the fact that xmltools force caret to position 0 after changing language” caught my eyes, so I did a quick test on a fresh NPP install under a virtual machine. I installed only the “Plugin Manager” then the XML Tools v2.4.6 plugin (no other plugins). I left the “Set XML type automatically” option enabled, then I opened several text files and I moved the caret combined with cycling through the tabs, but the issue did not manifest itself. Then I started to open files, like Python, Perl, Cpp, Xml, … then suddenly on some of the tabs I lost the caret position (was reset to 0), but not on all tabs. After restarting NPP all caret positions were reset to position 0 except the first two tabs with text files (there were other text files open too which lost the caret position). Dragging the second tab to right made no change while using NPP, but after a new NPP restart, that tab lost the caret position too. This shows that the issue is not coming from a conflict with another plugin, and that having different files with different languages open in the same time, triggers this issue.
I replaced the XML Tools plugin with the new 2.4.7 alpha version keeping the same set of files open in NPP and the issue is gone. I can place the caret anywhere, change tabs, restart NPP … the caret is not reset anymore with this version.
Thank you!
Best Regards,
Zoltan Gal-Bancsi