This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 166451 - Strip trailing spaces on file save
Summary: Strip trailing spaces on file save
Status: RESOLVED DUPLICATE of bug 157561
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: mslama
Depends on:
Reported: 2009-06-03 07:06 UTC by k776
Modified: 2009-12-04 01:48 UTC (History)
1 user (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description k776 2009-06-03 07:06:26 UTC
Strip trailing spaces on file save. Currently I've got CTRL+SHIFT+T mapped to trim, but would really like a way to do
this automatically.
Comment 1 Jiri Prox 2009-06-08 13:35:29 UTC
This should be already implemented - the save action should remove trailing space from all lines is current file.
Can you please verify it once more time if it doesn't work for you.
Comment 2 Filip Zamboj 2009-06-22 13:23:22 UTC
closing as resolved due to inactivity and no verifiaction from reporter. Thanks. 
Comment 3 k776 2009-06-23 06:28:59 UTC
Sorry for the delay. The save action does NOT strip trailing spaces on save. I tested with spaces on new lines and
existing lines, and nothing was stripped off the ends of the lines.
Comment 4 Jiri Prox 2009-06-23 09:54:30 UTC
Can you provide the exact build number and sample file with marked position of cursor while saving?
Comment 5 k776 2009-06-26 01:36:47 UTC
Build: 200905282243


class This  
  def this  
    print "this"  [cursor]

(trailing spaces after every line)

I save. No change. I close and reopen. No change. I have to run the strip command then save before it works.
Comment 6 mblaschke 2009-10-28 08:37:40 UTC
Netbeans (6.8 M2) doesn't remove trailing spaces in the line of the cursor (only before the cursor).

These whitespaces are also stored if i close and reopen the document, set the cursor into another line and save the
document again.
Comment 7 Vitezslav Stejskal 2009-10-29 15:20:33 UTC
This works fine in my dev build. Just to make sure that we all understand how this feature works. The trailing spaces
are removed (1) only from lines that you modified before saving and (2) they are not removed on the line where the
cursor is.

#1 - needed for VCS controlled files
#2 - the editor must not change the caret position when saving files

We had bug reports requesting both #1 and #2 and so it is highly unlikely that the current behavior will be changed.
Comment 8 mblaschke 2009-10-29 15:46:43 UTC
Eg. Eclipse, Zend Studio and Kate (KDE Advanced Editor) removes the trailing spaces on ALL lines (also in the current
cursor line) when saving.

It would be nice if NetBeans may have the same behavior than the other major IDEs.
Comment 9 Vitezslav Stejskal 2009-10-30 14:48:01 UTC
Well, I'm sure there will be people objecting at least as loudly as you are supporting this cause. We could probably
support both styles and add an options that would control, which one is used.
Comment 10 David Strupl 2009-12-04 01:04:14 UTC
Isn't this duplicate of issue 157561?
Comment 11 Vitezslav Stejskal 2009-12-04 01:48:07 UTC
I think so.

*** This bug has been marked as a duplicate of bug 157561 ***