GNOME Bugzilla – Bug 756705
editor silently strips form feed characters
Last modified: 2015-10-16 19:47:37 UTC
If an input file contains a form feed (ASCII 12, '\f', '^L') then it will be silently stripped on save. For example, these are not uncommon in GNU projects (grepping the binutils/GDB source repo shows 3567, not including the testsuites), and removing them randomly is surely frowned upon. Vim, and Emacs display them as "^L". Sublime text has an "FF" glyph-sort-of-thing. All of them leave the character in when saving. Regardless of how they are displayed, or whether this sort of thing serves any purpose any more, Gnome Builder should not be silently modifying anything in the file, white-space or not.
Builder itself strips trailing whitespace only from lines that are modified as recognized by the version control system (only git currently). Are you seeing them stripped from lines that were not edited? If so, that would be a bug in GtkSourceView that we should address there.
I should also note that you can disable trimming of trailing whitespace in the preferences, on a per-language basis. Preferences can be activated from the application menu, or ctrl+comma keyboard shortcut. Go to the "Programming Languages" section, and then select your target language, such as "C". You'll then see an option named "Trim trailing whitespace when saving document".
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version. We no longer use g_unichar_isspace() to detect whitespace and instead only trim space (' ') or horizontal tab ('\t'). See commit eea3027a4db73fd123864e14d569f7dd4ce82861 for the fix.
Oops, I broke trimming with that. Fixed with commit 4298a6b03b77730c4133d0b54048e0e12ed88027.