Enabling block caret for the OVR mode.
-
URL: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4467
Hi everyone. Before, I was able to make the caret appear as a block caret, that is, encompassing the whole letter.
By default, it is just a small red line under the letter.With the PythonScript plugin, I could do it with the following code:
CARETSTYLE_OVERSTRIKE_BLOCK = 16 editor.setCaretStyle(CARETSTYLE_OVERSTRIKE_BLOCK)However, this code now just makes the caret disappear instead.
Does anyone know how to fix it?I do know it has to do with the fact that a more recent version of Scintilla is being used in the more recent
versions of Notepad++ and that that broke this code which was working before. -
As pointed out HERE, a solution to this is to change the code to:
editor.setCaretStyle(editor.getCaretStyle() | CARETSTYLE.OVERSTRIKE_BLOCK) -
And in case you couldn’t tell from Alan’s post, Python Script defines the
CARETSTYLEenum, with theCARETSTYLE.OVERSTRIKE_BLOCKvalue already defined for you, so you don’t need to define your ownCARETSTYLE_OVERSTRIKE_BLOCK = 16variable.Any time you feel you need to define a constant in a PythonScript script to reference a particular value that you need to set in a Scintilla message (ie, any time the Scintilla documentation for that message has a table of values), check the PythonScript enums documentation – and the vast majority of the time, you will see that the PS author has already given you an enum with that value defined with an appropriate name.
-
check the PythonScript enums documentation
Perhaps at the time @Ekopalypse wrote the original script for @SalviaSage, the PythonScript structures and docs hadn’t “caught up” with potentially newer Scintilla features? And thus Eko would have had no choice but to hardcode a value. Just a guess, I’m not going to take the time to verify that.
-
BTW, here’s my cheezy little script that mines these enumerations:
from __future__ import print_function import Npp console.clear() for item in dir(Npp): try: d = eval('Npp.' + item + '.values') for k in d: print('{0}.{1} : {2} / 0x{2:X}'.format(item, d[k], k)) print('-' * 80) except AttributeError: continueThis prints output to the PythonScript console window for easy copying to another file to save for future ref; here’s a sample of some of the output:
ACCESSIBILITY.DISABLED : 0 / 0x0 ACCESSIBILITY.ENABLED : 1 / 0x1 -------------------------------------------------------------------------------- ALPHA.TRANSPARENT : 0 / 0x0 ALPHA.NOALPHA : 256 / 0x100 ALPHA.OPAQUE : 255 / 0xFF -------------------------------------------------------------------------------- ANNOTATIONVISIBLE.HIDDEN : 0 / 0x0 ANNOTATIONVISIBLE.STANDARD : 1 / 0x1 ANNOTATIONVISIBLE.BOXED : 2 / 0x2 ANNOTATIONVISIBLE.INDENTED : 3 / 0x3 -------------------------------------------------------------------------------- -
I hardly know what I did last week, much less what I was thinking 3 years ago when I wrote this ;-)
-
Thanks to everyone for their replies.
Again, we fixed this issue. -
A Alan Kilborn referenced this topic on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login