Margin Click Notification Callback

Help
Jim
2014-04-27
2014-04-27
  • Jim
    Jim
    2014-04-27

    Hello,

    My question is about the MARGINCLICK Notification. My basic callback works, and looks like this

    def toggle_breakpoint(args):
        console.write("margin click:\n")
        console.write(repr(args))
        console.write("\n")
    
    editor.callback(toggle_breakpoint, [SCINTILLANOTIFICATION.MARGINCLICK])
    

    This callback is being executed, and the output is:

    margin click:
    {'code': 2010, 'margin': 1}
    

    My question is - how do I get the line number of the click so I can add the marker to the clicked line? The Scintilla docs say there should be 3 fields returned by the notification[1]: the key modifiers, the position, and the margin number.

    SCN_MARGINCLICK
    This notification tells the container that the mouse was clicked inside a margin that was marked as sensitive (see SCI_SETMARGINSENSITIVEN). This can be used to perform folding or to place breakpoints. The following SCNotification fields are used:
    Field   Usage
    modifiers   The appropriate combination of SCI_SHIFT, SCI_CTRL and SCI_ALT to indicate the keys that were held down at the time of the margin click.
    position    The position of the start of the line in the document that corresponds to the margin click.
    margin  The margin number that was clicked.
    

    Thank you.

    [1] http://www.scintilla.org/ScintillaDoc.html#SCN_MARGINCLICK

     
    Last edit: Jim 2014-04-27