Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Enabling block caret for the OVR mode.

    Help wanted · · · – – – · · ·
    4
    7
    204
    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.
    • SalviaSage
      SalviaSage last edited by

      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.

      PeterJones 1 Reply Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn last edited by PeterJones

        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
        • PeterJones
          PeterJones @SalviaSage last edited by

          @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.

          Alan Kilborn 1 Reply Last reply Reply Quote 2
          • Alan Kilborn
            Alan Kilborn @PeterJones last edited by Alan Kilborn

            @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.

            Ekopalypse 1 Reply Last reply Reply Quote 2
            • Alan Kilborn
              Alan Kilborn last edited by Alan Kilborn

              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
              • Ekopalypse
                Ekopalypse @Alan Kilborn last edited by

                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
                • SalviaSage
                  SalviaSage last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright © 2014 NodeBB Forums | Contributors