• Login
Community
  • Login

Enabling block caret for the OVR mode.

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 4 Posters 715 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    SalviaSage
    last edited by Aug 22, 2022, 1:30 AM

    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.

    P 1 Reply Last reply Aug 22, 2022, 1:15 PM Reply Quote 0
    • A
      Alan Kilborn
      last edited by PeterJones Aug 22, 2022, 1:11 PM Aug 22, 2022, 12:04 PM

      As pointed out HERE , a solution to this is to change the code to:

      editor.setCaretStyle(editor.getCaretStyle() | CARETSTYLE.OVERSTRIKE_BLOCK)
      
      1 Reply Last reply Reply Quote 2
      • P
        PeterJones @SalviaSage
        last edited by Aug 22, 2022, 1:15 PM

        @SalviaSage ,

        And in case you couldn’t tell from Alan’s post, Python Script defines the CARETSTYLE enum, with the CARETSTYLE.OVERSTRIKE_BLOCK value already defined for you, so you don’t need to define your own CARETSTYLE_OVERSTRIKE_BLOCK = 16 variable.

        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.

        A 1 Reply Last reply Aug 22, 2022, 1:22 PM Reply Quote 2
        • A
          Alan Kilborn @PeterJones
          last edited by Alan Kilborn Aug 22, 2022, 1:24 PM Aug 22, 2022, 1:22 PM

          @PeterJones

          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.

          E 1 Reply Last reply Aug 23, 2022, 3:11 AM Reply Quote 2
          • A
            Alan Kilborn
            last edited by Alan Kilborn Aug 22, 2022, 1:30 PM Aug 22, 2022, 1:29 PM

            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:
                    continue
            

            This 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
            --------------------------------------------------------------------------------
            
            1 Reply Last reply Reply Quote 3
            • E
              Ekopalypse @Alan Kilborn
              last edited by Aug 23, 2022, 3:11 AM

              I hardly know what I did last week, much less what I was thinking 3 years ago when I wrote this ;-)

              1 Reply Last reply Reply Quote 2
              • S
                SalviaSage
                last edited by Aug 28, 2022, 10:15 PM

                Thanks to everyone for their replies.
                Again, we fixed this issue.

                1 Reply Last reply Reply Quote 0
                • A Alan Kilborn referenced this topic on Jul 10, 2023, 8:35 PM
                1 out of 7
                • First post
                  1/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors