• Login
Community
  • Login

Highlight Current COLUMN

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
highlighting
5 Posts 2 Posters 6.5k 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.
  • V
    VinsWorldcom
    last edited by Aug 12, 2015, 2:29 AM

    I created a plugin to highlight the current column the same way highlight current line is provided for in the settings. I did this by using the long lines edge indicator and tracking SCN_PAINT events to update the location. The very simple plugin just enables and disables the feature, resetting the edge indicator to the original position.

    Code can be found on GitHub: https://github.com/vinsworldcom/nppColHighlight

    I’d love some feedback / comments as this is my first attempt at a plugin after about 8 hours of reading the docs / demo plugin.

    Cheers.

    1 Reply Last reply Reply Quote 0
    • D
      dail
      last edited by Aug 12, 2015, 11:43 AM

      Don’t know if you saw it but I made a comment on your initial commit. It looks like in the pluginInit() function you are using the Scintilla handles. However I believe they haven’t actually been created at this time. Technically within getCurScintilla() it should fail since calling NPPM_GETCURRENTSCINTILLA may still leave which as -1. You might try moving the code within pluginInit() into beNotified() and catch the NPPN_READY notification which signals N++ is completely ready (thus access to Scintilla handles should be valid then).

      1 Reply Last reply Reply Quote 0
      • V
        VinsWorldcom
        last edited by Aug 12, 2015, 11:57 AM

        Thanks for the tip. I"ll check it out. I took the code directly from the demo plugin:

        http://download.tuxfamily.org/nppplugins/NppPluginTemplate/NppPluginTemplate.zip

        There was nothing in the pluginInit() sub in that example, and I didn’t know the proper handles may not be ready.

        cheers.

        1 Reply Last reply Reply Quote 0
        • D
          dail
          last edited by Aug 12, 2015, 12:15 PM

          The template is very outdated although still worth referencing. My understanding is that the pluginInit() (which is just called directly from DllMian) is mostly just for any setup the plugin needs to do – like a constructor. The NPPN_READY notification is the time to actually start working with N++/Scintilla.

          1 Reply Last reply Reply Quote 0
          • V
            VinsWorldcom
            last edited by Aug 12, 2015, 1:15 PM

            Brilliant - that’s the type of advice I was hoping for in posting here / there / and everywhere!

            As it is, the plugin is very simple and the only setup required is to save the original long lines edge indicator status (position and mode). I do this in the enable routine enColHi(). So the pluginInit() stuff really was redundant.

            Thanks very much.

            1 Reply Last reply Reply Quote 0
            4 out of 5
            • First post
              4/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors