[geany/geany] b8fa21: Never strip trailing spaces for Diff documents

Nick Treleaven git-noreply at geany.org
Thu Nov 15 13:39:55 UTC 2012


Branch:      refs/heads/master
Author:      Nick Treleaven <nick.treleaven at btinternet.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Thu, 15 Nov 2012 13:39:55 UTC
Commit:      b8fa21ff3baf773badf65548338d3b5ea7d47080
             https://github.com/geany/geany/commit/b8fa21ff3baf773badf65548338d3b5ea7d47080

Log Message:
-----------
Never strip trailing spaces for Diff documents


Modified Paths:
--------------
    doc/geany.html
    doc/geany.txt
    src/editor.c

Modified: doc/geany.html
17 files changed, 12 insertions(+), 5 deletions(-)
===================================================================
@@ -2378,9 +2378,9 @@ <h2 class="subtitle" id="a-fast-light-gtk-ide">A fast, light, GTK+ IDE</h2>
 <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 @@ <h2 class="subtitle" id="a-fast-light-gtk-ide">A fast, light, GTK+ IDE</h2>
 <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 @@ <h2 class="subtitle" id="a-fast-light-gtk-ide">A fast, light, GTK+ IDE</h2>
 <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>


Modified: doc/geany.txt
13 files changed, 9 insertions(+), 4 deletions(-)
===================================================================
@@ -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.


Modified: src/editor.c
4 files changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -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--;



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).


More information about the Commits mailing list