Skip to content

SCN_MARGINRIGHTCLICK does not return margin #250

@vinsworldcom

Description

@vinsworldcom

According to Scintilla docs SCN_MARGINRIGHTCLICK should return the same arguments as SCN_MARGINCLICK - modifiers, position, margin. However, it does not. A simple example:

from Npp import editor, SCINTILLANOTIFICATION

class RCT(object):
    def __init__(self):
        editor.callbackSync(self._on_margin, 
            [SCINTILLANOTIFICATION.MARGINCLICK, 
            SCINTILLANOTIFICATION.MARGINRIGHTCLICK]
        )

    def _on_margin(self, args):
        print(args)

if __name__ == '__main__':
    rct = RCT()

Generates the following from a left-click (normal as expected) and then a right-click (lots of arguments, not the ones expected and no margin):

{'code': 2010, 'idFrom': 0, 'hwndFrom': 3870106, 'margin': 1, 'position': 544, 'modifiers': 0}
{'code': 2031, 'idFrom': 0, 'hwndFrom': 3870106, 'position': 544, 'modificationType': 0, 'length': 0, 'linesAdded': 0, 'line': 0, 'foldLevelNow': 0, 'foldLevelPrev': 0, 'annotationLinesAdded': 0, 'listType': 0, 'message': 0, 'wParam': 0, 'lParam': 0, 'modifiers': 0, 'token': 0, 'x': 0, 'y': 0}

There seems to be a case statement missing from 'PythonScript\src\ScintillaWrapper.cpp':

diff --git a/PythonScript/src/ScintillaWrapper.cpp b/PythonScript/src/ScintillaWrapper.cpp
index 2d1bd37..2707ecc 100644
--- a/PythonScript/src/ScintillaWrapper.cpp
+++ b/PythonScript/src/ScintillaWrapper.cpp
@@ -172,6 +172,12 @@ void ScintillaWrapper::notify(SCNotification *notifyCode)
                        case SCN_MARGINCLICK:
                                params["margin"] = notifyCode->margin;
                 params["position"] = notifyCode->position;
+                params["modifiers"] = notifyCode->modifiers;^M
+                               break;^M
+^M
+                       case SCN_MARGINRIGHTCLICK:^M
+                               params["margin"] = notifyCode->margin;^M
+                params["position"] = notifyCode->position;^M
                 params["modifiers"] = notifyCode->modifiers;
                                break;

That seems to be the fix - see PR #251

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions