Calltip on mouse-over from UDL xml file (Python)
-
I had some free time and had another go at multiple overloads, but there seems to be a bug with the down arrow in the tooltip / and the alt+down shortcut combo when using PythonScript. Obviously there is nothing wrong with the standard implementation of this feature, only when creating a custom tooltip with PythonScript does this CTD happen.
I did a small test with the SCINTILLANOTIFICATION.CALLTIPCLICK and this was the result, position 0 is clicked anywhere but the arrows, position 1 is clicked on the up arrow and position 2 should be clicked on the down arrow… but this results in Notepad++ crashing to desktop.
-
@Khundian-Twitch ,
Just a note, and I’m not sure if this is relevant with what you’re doing with pythonscript, but the calltip functions are triggered by a delimiter insertion, meaning when you type the keyword, and then click a parens if it is the opening for a function, then the calltip pops up, and you have to use the mouse to click the buttons up or down.What you’re doing, may not make what I just mentioned relevant, since it sounds like you’re past my knowledge, but I thought I might mention in in case it is relevant.
-
@Khundian-Twitch said in Calltip on mouse-over from UDL xml file (Python):
I did a small test with the SCINTILLANOTIFICATION.CALLTIPCLICK and this was the result, position 0 is clicked anywhere but the arrows, position 1 is clicked on the up arrow and position 2 should be clicked on the down arrow… but this results in Notepad++ crashing to desktop.
Exits with
Exception Code: c0000094
which is a division by zero code. Seems the
position
key cannot return a value2
as it fails to get a value.Also a second error
Exception Code: c000041d
A STATUS_FATAL_USER_CALLBACK_EXCEPTION code.
This is what I tested with:
from Npp import console, editor, notepad, SCINTILLANOTIFICATION try: callback_registry except: callback_registry = [] calltip_wrap = ['\x01 one\n\x02 description', '\x01 two\n\x02 description'] if not editor.callTipActive(): editor.callTipShow(editor.getCurrentPos(), calltip_wrap[0]) def calltip_update(args): console.write(args) pos = editor.getCurrentPos() if editor.callTipActive(): if args['position'] == 2: editor.callTipCancel() editor.callTipShow(pos, calltip_wrap[0]) elif args['position'] == 1: editor.callTipCancel() editor.callTipShow(pos, calltip_wrap[1]) return True if 'calltip_update' not in callback_registry: callback_registry.append('calltip_update') editor.callback(calltip_update, [SCINTILLANOTIFICATION.CALLTIPCLICK])
-
@mpheath Thanks for taking the time to test, reply and clarify the issue.
I guess I’m out of luck. I wonder if it’s something with the PythonScript plugin, when I have some time I’m gonna test with the LuaScript plugin and see if the same happens when creating a calltip. -
I tested with the LuaScript plugin and exactly the same happens, I guess it has nothing to do with either Python or LUA plugin. I guess its a bug in Scintilla or Notepad++. I’ll post the LUA code I used to test below.
function showcalltip(ch) calltip = "\001 <Click> \002" pos = editor.CurrentPos editor:CallTipShow(pos, calltip) return false end function printclick(flag) print(flag) return false end print("Test script running.") npp.AddEventHandler("OnChar", showcalltip) npp.AddEventHandler("OnCallTipClick", printclick)
-
@Khundian-Twitch said in Calltip on mouse-over from UDL xml file (Python):
I guess its a bug in Scintilla or Notepad++
A crash is a pretty big deal; someone should open an official bug report on github.
-
@Alan-Kilborn said in Calltip on mouse-over from UDL xml file (Python):
@Khundian-Twitch said in Calltip on mouse-over from UDL xml file (Python):
I guess its a bug in Scintilla or Notepad++
A crash is a pretty big deal; someone should open an official bug report on github.
I agree, but I’m not sure if this qualifies as a bug in Notepad++?
The standard implementation of using the arrows to cycle through multiple overloads works fine. Its only when a user starts tinkering with script plugins and creating their own calltips that this crash will occur. -
I created a bug report on github, guess we’ll see if it qualifies as a bug. Link to report
-
@mpheath Seems it was something in the Notepad++ code, but solved very quickly by the guys on github. Without a doubt the debug info you provided had something to do with that, Thanks again! :)
-
@Khundian-Twitch Well done! I tested the artifact in PR #14667 that solves the crash issue and so now position
2
is possible for the down arrow of the calltip. -
I have finished the script, if anyone is interested I posted it in the Plugin development forum.
Thanks again to everyone who helped me out!