Page 1 of 1

Small request: Strip trailing spaces, but NOT b4 the cursor

Posted: Sat May 31, 2014 6:22 pm
by jeffy
I also always have the "Strip trailing spaces from lines when saving" setting checked.

The one thing that annoys me about it is, if the cursor happens to follow some whitespace, it is moved to column zero.

I wish there was a sub-setting under "Strip trailing spaces from lines when saving", to say "Do not strip whitespace immediately before cursor".

Posted: Fri Jun 06, 2014 3:38 pm
by Mordachai
Isn't virtual spaces the correct and universal solution to this issue?

Posted: Tue Jun 10, 2014 10:52 am
by jeffy
What are virtual spaces?

Posted: Tue Jun 10, 2014 1:48 pm
by Mordachai
Many text editors allow you to turn on 'virtual spaces', which then allows you to place your cursor wherever you want - beyond the end of any given line, but it won't create spaces to fill the difference until you start typing real characters.

So, if you combine that with strip trailing spaces when saving a file, then it will remove all of the trailing whitespace, but won't move your cursor. If you then type something, those spaces will automatically be recreated and the next time you save, they'll be preserved.

So, not exactly what you're asking for, but maybe as useful to you (you'll have to answer that).

OH! I found it - in TextPad it's called "Constrain the cursor to the text" - under Preferences, Editor - first check-box.

Uncheck that, and it will allow your cursor to be wherever you want. Maybe that will be useful to you?

Posted: Tue Jun 10, 2014 2:39 pm
by jeffy
I only care about the cursor not moving, as you say, I don't actually care if the spaces are stripped in the file itself, I just don't want the cursor moving when I save.

So +1 to virtual spaces.

The constrain to text only works when word-wrap is off. I mostly keep it on. But worth a try!

Posted: Tue Jun 10, 2014 7:54 pm
by Mordachai
Sounds like TextPad has a bug with word-wrap. It shouldn't allow you to put your cursor past the end of a word-wrapped line in the middle, but it should allow you to place it past the end of the paragraph, just like normal non-word-wrapped lines allow when 'constrain cursor' is turned off.