During movement mouse cursor along line with indicator "hover" style the cursor is flipping rapidly
between "Window::cursorHand" and "Window::cursorText".
Simple modification by removing the last part of "if" statement in ScintillaWin.cxx where message"WM_SETCURSOR" is handled solves the problem. That means:
}// else {
//DisplayCursor(Window::cursorText);
//}
The cursor is correctelly switched in "Editor.cxx": SCI_SETCURSOR:
so I have not notice any problem with proper cursor state, after this change .
You appear to be refering to an old version of Scintilla since the mentioned code is not present in 4.3.2 with a change to
DisplayCursor(ContextCursor());. Its likely the right thing to do is to add more cases to ContextCursor so it can be called whenever needed instead of relying on mouse button changes.The reason, why the flicker occurs, is the following: There are two Windows messages sent by Windows to Scintilla, when the mouse is moved:
WM_MOUSEMOVEandWM_SETCURSOR.WM_MOUSEMOVEinforms Scintilla, that the mouse has been moved inside its window.WM_SETCURSORinforms Scintilla, that the mouse cursor has been moved. Anywhere, not necessarily in its window.Scintilla calls the Windows function
SetCursor(, which sets the mouse cursor shape, not the position), while processing both messages. Unfortunately, Scintilla uses different ways to calculate the desired cursor shape. So, whenever the mouse cursor is moved, twoSetCursorcalls are applied, sometimes with two different cursor shapes.WM_MOUSEMOVE, Scintilla callsButtonMoveWithModifiers, which sets the correct cursor shape.WM_SETCURSOR, Scintilla calculates the cursor shape by a call to the functionWindow::Cursor ScintillaWin::ContextCursor(), which calculates a different cursor shape while hovering over indicators.The problem could be removed by modifying the
ContextCursor()function as follows:}
I have added the
(hoverIndicatorPos != Sci::invalidPosition)comparison, which is until now only included in theButtonMoveWithModifiersfunction.I feel it would be the easiest way if you could include the two lines into the code yourself, if you think they are correct, of course.
Please let me know, if I can assist in any way to get this effect fixed, because some Notepad++ users are not very happy about the flickering, and I kind of introduced it in Notepad++ by suggesting to use standard indicators instead of style byte indicators. I did it, because ScintillaDoc.html says so, and now, I would like to get it work completely smooth.
Committed as [cb319e].
It is credited to 'uhf7'. If you want a different name used then please tell me.
A subsequent commit [7b1106] simplified the code a little.
Related
Commit: [7b1106]
Commit: [cb319e]
Thank you for the incredibly fast reaction, I just tested it on my system, it worked. I'm going to carry the good news to the Notepad++ developers now.
Ok, now I have a new effect introduced, which is much less annoying, but I want to remove it too. It goes like this:
WM_SETCURSORmessage occurs not on mouse moves only, but on mouse clicks too.I didn't see it in the first place, but I it can be removed easily. If I click to the area after the end of file, then the caret is set to the end of file. At this occasion, the
hoverIndicatorPosis set to this position too. But theWM_SETCURSORmessage for the mouse click occurs at another position, after the end of file. In this moment, thehoverIndicatorPosdoes not match the mouse position. I fixed with a validity check in theContextCursor()function:}
Can you please insert this check too? Then the flickering problem is hopefully solved.
The Notepad++ developers want to wait for a Scintilla release 4.4.5. Before this, I want to insert two other new lines into the code, but I will open a new issue for this, it has nothing to do with the flickering problem.
Committed as [34147e] with small change to avoid calculating PositionFromLocation unless needed.
Related
Commit: [34147e]
Thank you again, the mouse cursor flicker issue should be resolved now for Notepad++.