[Geany-devel] Strip trailing blank lines (patch included)

Eugene Arshinov earshinov at xxxxx
Wed Aug 26 15:48:30 UTC 2009

Hi all.

Everybody knows that Geany has menu item "Document > Strip trailing 
spaces" and option to do it automatically when a document is saved. My 
proposal is another command, something like "Strip trailing blank 
lines", to remove blank lines in the end of file (as they are absolutely 
useless there).

I wrote new `editor_strip_trailing_newlines' function (see the attached 
patch). Currently I call it directly from `document_save_file' if 
`strip_trailing_spaces' setting is set. Of course, it's not how it 
should be. Maybe separate menu item and option should be added, like for 
trailing spaces. Alternative way is to combine those, i.e., rename 
"Strip trailing spaces" to "Remove excessive whitespace" :-) These all 
are usability issues, with which I don't like to deal. If any of the 
developers has an opinion upon those, I'll consider it and update the patch.

P.S. My code leaves one trailing newline if `final_new_line' setting is 
set. Otherwise, it removes all trailing newlines. I believe it is right.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geany.3.patch
Type: text/x-patch
Size: 2386 bytes
Desc: not available
URL: <http://lists.geany.org/pipermail/devel/attachments/20090826/a642dbf7/attachment.bin>

More information about the Devel mailing list