Menu

How to set the color of a bookmarked line?

Chris
2009-09-03
2012-11-13
  • Chris

    Chris - 2009-09-03

    Where can i set the background color of a line i bookmarked?

    It used to be yellow by default in an older version of Notepad++.

    Cant find an entry for it in styler configurator or stylers.xml.

    With Preferences > Edit Cimponents -> Display Bookmark Margin the bookmarked line
    is displayed with a bullet but i want the whole line to be visually marked.

    Any ideas?

     
    • cchris

      cchris - 2009-09-03

      The following macro definitions are to be inserted in shortcuts.xml between <Macros> and </Macros>, preferrably right after the former or before the latter. Please read the termùinal section of http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Configuration_Files for a detailed how-to. Using a different editor is the simplest way, but is not necessary.

      The folowing will change the backgrounnd color for the ookmark marker:
      <Macro name="bookmark_bk" Ctrl="yes" Alt="yes" Shift="no" Key="100">
         <Action type="0" message="2041" wParam="24" lParam="<your_color>" sParam=""/>
      </Macro>

      <your_color> is the decimal value of a RGB color representation, lke in HTML. That would be 255 for full blue, for instance.

      Change 2041 to 2042 and you'll adjust the foreground color. You can also change the translucency of the background.

      Instead of disabling the bookmark margin, which will also show hidde line marks as background and confuse Compare, you ay want to prevent the bookmark being displayed on that margin, leaving other markers alone. The macro to do this is
      <Macro name="bookmark_to_bk" Ctrl="yes" Alt="yes" Shift="no" Key="100">
         <Action type="0" message="2244" wParam="1" lParam="12582912" sParam=""/>
      </Macro>
      and this one  brings it back
      <Macro name="bookmark_to_mgn" Ctrl="yes" Alt="yes" Shift="no" Key="100">
         <Action type="0" message="2244" wParam="1" lParam="29360128" sParam=""/>
      </Macro>

      CChris

       
      • Chris

        Chris - 2009-09-03

        Thanks for the quick response! And good to hear it seems to be possible somehow.. after my post ive spend another few hours trying to figure it out, obviously with no result whatsoever.. ah well.

        The reply looks hopeful.

        I tried adding this code:

        </Macro>
                    <Macro name="bookmark_bk" Ctrl="yes" Alt="yes" Shift="no" Key="100">
        <Action type="0" message="2041" wParam="24" lParam="255" sParam=""/>

        To the shortcuts.xml (between <Macros></Macros> where my other macro's are located
        (so i am editting the right file)

        But nothing seems to happen (..when i run the macro).  Obviously im doing something wrong, but what step did i miss?

         
    • Chris

      Chris - 2009-09-03

      Ok, ive investigated it a bit further (im new to this so be patient):

      The 2042 thingy calls the scintilla engine 's MarkerSetBack to set the background color as specified in lparam.  This is basicly the idea right?

      Doesnt seem to work, ive tried it with and without loading stylers.xml but i dont seem to be able to change the background color of the line. Im using the latest version of NPP.
      How do i set the transparancy?

       
    • cchris

      cchris - 2009-09-03

      By setting the message field to "2476" and lParam to the opacity index, between 0 (invisible) and 255 (fully opaque).

      As you figured out, the idea is to use the macro playback engine to send messsages to Scintilla.

      I'll see tomorrow what could be wrong, the code is right, and, if you see the macro in your macro menu, your edit was succesful.

      CChris

       
    • Chris

      Chris - 2009-09-04

      <Macro name="bookmark_to_bk" Ctrl="yes" Alt="no" Shift="no" Key="32">
      <Action type="0" message="2042" wParam="24" lParam="240050190" sParam="" />
      <Action type="2" message="0" wParam="43005" lParam="0" sParam="" />
      </Macro>

      Yeehee..It works: there was a conflict with the Bookmark margin.

      Also i removed the CTRL-SPACE toggle i defined for a bookmark from the Shortcut mapper
      and inserted the 43005 Scint. Mark command into the macro which i mapped to CTRL-SPACE.

      Thank you!

       
    • Chris

      Chris - 2009-09-03

      I mean this code:

      <Macro name="bookmark_bk" Ctrl="yes" Alt="yes" Shift="no" Key="100">
      <Action type="0" message="2041" wParam="24" lParam="225" sParam=""/>
      </Macro>

       
    • Chris

      Chris - 2009-09-04

      Great., would really appreciate that!

      Ive been using npp at least 5 hours a day for the last 3 years and since this feature dissapeared during an update i just cant let it go!

       
MongoDB Logo MongoDB