Never strip trailing spaces for Diff documents

This commit is contained in:
Nick Treleaven 2012-11-15 13:34:19 +00:00
parent e9e41ee47b
commit b8fa21ff3b
3 changed files with 25 additions and 9 deletions

View File

@ -2378,9 +2378,9 @@ is folded.</dd>
<dt>Use indicators to show compile errors</dt>
<dd>Underline lines with compile errors using red squiggles to indicate
them in the editor area.</dd>
<dt>Newline strip trailing spaces</dt>
<dd>Remove any white space at the end of the line when you hit the
Enter/Return key.</dd>
<dt>Newline strips trailing spaces</dt>
<dd>Remove any whitespace at the end of the line when you hit the
Enter/Return key. See also <a class="reference internal" href="#strip-trailing-spaces">Strip trailing spaces</a>.</dd>
<dt>Line breaking column</dt>
<dd>The editor column number to insert a newline at when Line Breaking
is enabled for the current document.</dd>
@ -2628,8 +2628,15 @@ can each be undone with the Undo command.</p>
<dt>Ensure consistent line endings</dt>
<dd>Ensures that newline characters always get converted before
saving, avoiding mixed line endings in the same file.</dd>
</dl>
<dl class="docutils" id="strip-trailing-spaces">
<dt>Strip trailing spaces</dt>
<dd>Remove the trailing spaces on each line of the document.</dd>
<dd><p class="first">Remove any whitespace at the end of each document line.</p>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">This does not apply to Diff documents, e.g. patch files.</p>
</div>
</dd>
<dt>Replace tabs by space</dt>
<dd><p class="first">Replace all tabs in the document with the equivalent number of spaces.</p>
<div class="note last">
@ -6809,7 +6816,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.</p>
<div class="footer">
<hr class="footer" />
<a class="reference external" href="geany.txt">View document source</a>.
Generated on: 2012-10-25 16:28 UTC.
Generated on: 2012-11-15 13:25 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>

View File

@ -2011,9 +2011,9 @@ Use indicators to show compile errors
Underline lines with compile errors using red squiggles to indicate
them in the editor area.
Newline strip trailing spaces
Remove any white space at the end of the line when you hit the
Enter/Return key.
Newline strips trailing spaces
Remove any whitespace at the end of the line when you hit the
Enter/Return key. See also `Strip trailing spaces`_.
Line breaking column
The editor column number to insert a newline at when Line Breaking
@ -2297,8 +2297,13 @@ Ensure consistent line endings
Ensures that newline characters always get converted before
saving, avoiding mixed line endings in the same file.
.. _Strip trailing spaces:
Strip trailing spaces
Remove the trailing spaces on each line of the document.
Remove any whitespace at the end of each document line.
.. note::
This does not apply to Diff documents, e.g. patch files.
Replace tabs by space
Replace all tabs in the document with the equivalent number of spaces.

View File

@ -4389,6 +4389,10 @@ void editor_strip_line_trailing_spaces(GeanyEditor *editor, gint line)
gint i = line_end - 1;
gchar ch = sci_get_char_at(editor->sci, i);
/* Diff hunks should keep trailing spaces */
if (sci_get_lexer(editor->sci) == SCLEX_DIFF)
return;
while ((i >= line_start) && ((ch == ' ') || (ch == '\t')))
{
i--;