After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 305816 - New plugin: remove trailing whitespace
New plugin: remove trailing whitespace
Status: RESOLVED OBSOLETE
Product: gedit-plugins
Classification: Other
Component: General
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2005-05-29 11:13 UTC by Pierre Ossman
Modified: 2020-11-24 10:17 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
complete patch (8.03 KB, patch)
2005-05-29 11:16 UTC, Pierre Ossman
none Details | Review
complete patch (7.50 KB, patch)
2005-08-21 12:09 UTC, Pierre Ossman
none Details | Review
Implement saving without trailing spaces (24.64 KB, patch)
2010-05-03 09:03 UTC, Garrett Regier
none Details | Review

Description Pierre Ossman 2005-05-29 11:13:11 UTC
The feature I miss the most from gedit is the ability to remove trailing
whitespace from files. Source files with a lot of trailing whitespace are simply
unclean ;)
Comment 1 Pierre Ossman 2005-05-29 11:16:13 UTC
Created attachment 46998 [details] [review]
complete patch

And just to show how badly I want this feature, here is a patch completely
implementing said feature.

It also adds the necessary code for having this function configurable. The only
thing missing is translation of the new text associated with the configuration.
I don't know all the languages supported by gedit so I'm afraid I can't do this
myself ;)

Please review and commit.
Comment 2 Paolo Maggi 2005-05-29 16:42:37 UTC
Comment on attachment 46998 [details] [review]
complete patch

Thank you for the patch. We  will review it as soon as possible.
Comment 3 Pierre Ossman 2005-08-18 12:19:44 UTC
*poke*

How's that review going? :)
Comment 4 Pierre Ossman 2005-08-21 12:09:00 UTC
Created attachment 51057 [details] [review]
complete patch

Patch updated to latest release of gedit.
Comment 5 Christian Kirbach 2005-08-22 08:32:27 UTC
confirming and raising priority.
Comment 6 Paolo Borelli 2005-08-22 09:23:09 UTC
Lowering priority, since even if with a patch, this is a request for enanchement
so we cannot get it in 2.12.

Pierre, Paolo Maggi is currently on vacation that's why he didn't comment on the
patch yet.

I gave the patch a quick look and the way you strip whitespaces is a bit dubious
to me (many memmoves, using isspace instead of g_unichar_isspace etc), but I may
be wrong...

More importantely I'm not sure we want to add this option as yet  another toggle
in the preferences dialog: we are really trying to keep options to a minimumn
and if possible reduce the ones we already have there. Maybe this functionality
should be implemented in a plugin.

Last but not least, I suggest you to work against the new_mdi cvs branch of
gedit, since that's where all the new developement will take place. See
http://live.gnome.org/Gedit/NewMdi.

Thanks again for the patch and sory for the untimely and small feedback :/
Comment 7 Pierre Ossman 2005-08-22 09:39:11 UTC
I chose not to be clever about the algorithm until it proves to be annoyingly
slow. As for not using g_unichar_isspace it's because I wasn't aware of the
function. Afraid I don't know glib that well...

I can fully agree with the sentiment to keep the preferences window clutter
free. I'd consider this a basic feature for a programmers editor, but in the end
you make that decision. I found it easier to hack directly in gedit instead of
learning the plug-in API.

I wasn't aware a new development branch was started but I'll have a look. Has
the plug-in API changed there?
Comment 8 Paolo Borelli 2005-08-22 09:45:50 UTC
Yep, the plugin system changed completely (and should be easier), that's why I
mentioned alongside the suggestion of turning it into a plugin.

The plugin interface is not very well documented yet, but there is a script in
tools/ that generates the plugin scheleton code for you and then you can look at
one of the plugins which have  already been ported to the new interface.
Comment 9 Garrett Regier 2010-05-03 09:03:23 UTC
Created attachment 160184 [details] [review]
Implement saving without trailing spaces

This patch does not remove the spaces but prevents them from being saved.

However not removing the spaces is actually nice because it allows you to continue working in the editor without its contents changing when you save.

Also, this avoids any issues with the undo manager.
Comment 10 Michael Catanzaro 2014-01-04 17:40:57 UTC
Does your patch remove trailing spaces from all lines in the file, or only from modified lines?
Comment 11 Robert Roth 2015-01-02 12:04:29 UTC
I'm not sure about this, but I think the patch needs an update (purely based on the date and the number of changes in gedit lately).

Btw, I tend to agree with Paolo's (fairly ancient) comment #8,  maybe it would be wise to have this implemented as a plugin.
Comment 12 Sébastien Wilmet 2015-01-02 13:46:37 UTC
The feature should be implemented in GtkSourceView in my opinion, since it is useful for lots of text editors. See bug #736585.
Comment 13 Sébastien Wilmet 2020-11-24 10:17:30 UTC
Mass-closing of all gedit-plugins bugzilla tickets.

Special "code" to find again all those gedit-plugins bugzilla tickets that were open before the mass-closing:

2bfe1b0590a78457e1f1a6a90fb975f5878cb60064ccfe1d7db76ca0da52f0f3

By searching the above sha256sum in bugzilla, the gedit contributors can find again the tickets. We may be interested to do so when we work on a specific area of the code, to at least know the known problems and possible enhancements.

We do this mass-closing because bugzilla.gnome.org is being replaced by gitlab.gnome.org.