Menu

pythonscript.dll > 0.9.2.0 causes NPP 6.6.6 crash!

Help
skrell
2014-07-14
2014-07-15
  • skrell

    skrell - 2014-07-14

    Today i tried updating your plugin for the 1st time in years only to find that not only do my scripts not work but my startup script causes NPP to hang forever. Here is my startup script in case it helps diagnose my problem:

    ~~~~import sys
    from Npp import *

    sys.stderr = console

    class ConsoleError:
    def init(self):
    global console
    self._console = console;

    def write(self, text):
        self._console.writeError(text);
    
    def flush(self):
        pass
    

    sys.stderr = ConsoleError()

    import site

    sys.stdout = editor

    import time

    def highlightall(args):
    current_file = notepad.getCurrentFilename()
    notepad.runMenuCommand('Search','Clear 5th Style')
    targetstring = editor.getSelText()
    notepad.runMenuCommand('View','Focus on Another View')
    next_file = notepad.getCurrentFilename()
    if current_file != next_file:
    numberfound = editor.searchNext(2,str(targetstring))
    if numberfound == -1:
    notepad.runMenuCommand('Search','Clear 5th Style')
    else:
    notepad.runMenuCommand('Search','Clear 5th Style')
    notepad.runMenuCommand('Search','Using 5th Style')
    time.sleep(0.1)
    notepad.runMenuCommand('View','Focus on Another View')

    editor.callback(highlightall,[SCINTILLANOTIFICATION.DOUBLECLICK])~~~~

     

    Last edit: skrell 2014-07-14
  • Dave Brotherstone

    Ok, reproduced and issue identified and fixed.

    Many thanks for reporting. There'll be a new release shortly.

    Cheers,
    Dave.

    PS. Useful script! I'd change the runMenuCommand() calls to name the sub-menu directly, e.g.:

    notepad.runMenuCommand('Unmark All', 'Clear 5th Style')
    

    That's the way it's supposed to work - it just so happens it works with the top level menu too. That may change in the future though.

     

Log in to post a comment.