Bug 203382 - Add an option to remove trailing whitespace on save
Summary: Add an option to remove trailing whitespace on save
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 5.0 M7   Edit
Assignee: Sergey Prigogin CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-09-13 19:16 EDT by Sergey Prigogin CLA
Modified: 2009-01-12 09:13 EST (History)
2 users (show)

See Also:


Attachments
Patch to implement remove trailing whitespace on save (7.38 KB, patch)
2008-04-10 06:44 EDT, Tor Arne Vestbø CLA
bjorn.freeman-benson: iplog+
torarnv: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Prigogin CLA 2007-09-13 19:16:07 EDT
There is already an option to ensure that there is a newline at the end of the file. Removing whitespace characters from the end of each line is another useful option to have in C/C++ editor.
Comment 1 Tor Arne Vestbø CLA 2008-04-10 06:43:04 EDT
+1

A patch implementing this feature is included. Code was ripped from the class org.eclipse.jdt.internal.corext.fix.CodeFormatFix, which seems to be part of the new "Clean Up" feature in JDT.

Preferably we would have the Clean Up feature in CDT too at some point, but from what I can tell it's very JDT-specific right now. Not sure how the process is for generalizing and moving code between JDT and platform. 

Please review, comments welcome! :)
Comment 2 Tor Arne Vestbø CLA 2008-04-10 06:44:43 EDT
Created attachment 95495 [details]
Patch to implement remove trailing whitespace on save
Comment 3 Sergey Prigogin CLA 2008-04-11 01:20:56 EDT
Fixed in HEAD > 20080410

Patch applied. Thanks a lot for contributing it.
Comment 4 Sergey Prigogin CLA 2008-05-04 00:36:36 EDT
Removal of trailing whitespace is enabled by default in HEAD > 20080503.
Comment 5 Doug Schaefer CLA 2008-06-03 15:26:17 EDT
assigning
Comment 6 Doug Schaefer CLA 2008-06-03 15:26:38 EDT
done