Menu

"Trim Trailing and Save" bug

Anonymous
2008-10-28
2012-11-13
  • Anonymous

    Anonymous - 2008-10-28

    Hi...

    If I use this macro command with the cursor inside a word, Notepad++ will insert 3 spaces and 2 tab character

    How to test:

    1) Create a new file and save it as "example.txt"

    2) Write the following sentence (where <space> means the space character):

    foobar<space><space>

    3) Leave the cursor between "foo" and "bar":  ( | represents the cursor):

    foo|bar<space><space>

    4) Use the "Trim Trailing and Save"

    As you will notice, Notepad++ get rids of the trailing space, but introduces some other characters:

    foo<space><space><space><tab><tab>bar<end of line>

    I did a quick search though the source code and found this configuration inside shortcuts.xml:

            <Macro name="Trim Trailing and save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
                <Action type="1" message="2170" wParam="0" lParam="0" sParam=" " />
                <Action type="1" message="2170" wParam="0" lParam="0" sParam=" " />
                <Action type="1" message="2170" wParam="0" lParam="0" sParam=" " />
                <Action type="0" message="2327" wParam="0" lParam="0" sParam="" />
                <Action type="0" message="2327" wParam="0" lParam="0" sParam="" />
                <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
                <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
            </Macro>

    Well, I don't know what "2170" and "2327" messages mean, but coincidentally there are 3 of "2170" and 2 of "2327", just like the 3 spaces and 2 tabs inserted in the text...   :-/

    Cheers,

    Roger

     
    • cchris

      cchris - 2009-06-27

      There is no need to edit shortcuts.xml: the macro posted by Harry simply reads:
      Edit -> Trim Trailing Space
      File -> Save

      You can consider the macro being shipped as only a test.

      CChris

       
    • Rafał

      Rafał - 2008-10-28

      I've posted about this problem before but there was no answer ever - https://sourceforge.net/forum/message.php?msg_id=5368191

      My guess is that this macro is just to show how things work and not really ment for normal usage.

      But I still think this is a bug.

       
      • DisgruntledGoat

        DisgruntledGoat - 2009-02-02

        Oh yeah it's definitely a bug. It's existed for over a year and still not been fixed. If it's a simple replacement as janschreiber suggested, it would be nice to finally fix it.

         
    • Anonymous

      Anonymous - 2008-10-28

      Yeah...  Indeed it seems a bug to me.

      I found also two tickets in bug tracker related to this issue:

      [2062701] "Trim trailing space and save" inserts tab
      [1927783] macro trailing spaces & save

       
    • Jan Schreiber

      Jan Schreiber - 2008-10-28

      I use this replacement, and it has worked fine so far:
          <Macros>
              <Macro name="&amp;Trim trailing whitespace and save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
                  <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
                  <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
              </Macro>
          </Macros>

       
    • Harry

      Harry - 2009-02-03

      After some delay, its fixed on the SVN, expect it to be in the next release (however, if you already have npp installed, I dont think the installer will touch shortcuts.xml if it is already present).

       
      • Anonymous

        Anonymous - 2009-06-26

        Many thanks, Harry...

        It's working fine now..

         
MongoDB Logo MongoDB