SublimeText / TrailingSpaces

Highlight trailing spaces and delete them in a flash.
MIT License
897 stars 94 forks source link

Automatic trailing white spaces on line move #86

Open eorroe opened 9 years ago

eorroe commented 9 years ago

So if I'm on a line of code and I move to another line the trailing spaces are automatically deleted from last line I was on.

Pros:

  1. When on an untitled tab where let's say I paste some code and edit it I'll be able to delete trailing spaces by moving from line to line (As of right now I can't delete trailing spaces on save since it's an untitled tab, so I have to call Delete Trailing spaces)
  2. No need to call Delete Trailing Spaces since it'll just delete all the trailing spaces when I move from line to line. (Yet you'll keep this simply because of people just installing this, and call this on files which they already have trailing spaces)
  3. Your algorithm wouldn't have to search the whole file for trailing spaces, again since it'll do it by moving from line to line.

    Cons:

I had one in mind but I already forgot so I'm not sure if there really is any.

So over all this would improve productivity because we don't need to wait till we save file, or call Delete Trailing Spaces

If this is a sure no, perhaps as an option in the settings

rchl commented 8 years ago

Could potentially be annoying in following situation:

  1. You press enter after writing a line. => Next line gets indented automatically
  2. You move back to previous line for a moment (maybe you forgot to add semicolon or something)
  3. You go back to previous line and now indentation is gone so you have to press tab.
eorroe commented 8 years ago

That's true and interesting, I can't really think of a way to avoid this, not sure if you can think of one, but perhaps leave this issue open just in case someone does?

rchl commented 4 years ago

To be fair, that auto-added indention is currently removed by ST on typing something on another line. But it still could get more annoying if trailing spaces would just be removed on navigating to another line.