SF.net SVN: geany:[5406] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Nov 15 13:06:11 UTC 2010
Revision: 5406
http://geany.svn.sourceforge.net/geany/?rev=5406&view=rev
Author: ntrel
Date: 2010-11-15 13:06:11 +0000 (Mon, 15 Nov 2010)
Log Message:
-----------
Don't use XML tag auto-indentation when '</' is to the right of the
cursor; allow auto-indentation when XML tag auto-closing is also
enabled.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.html
trunk/doc/geany.txt
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-11-14 20:44:00 UTC (rev 5405)
+++ trunk/ChangeLog 2010-11-15 13:06:11 UTC (rev 5406)
@@ -1,3 +1,11 @@
+2010-11-15 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/editor.c, doc/geany.txt, doc/geany.html:
+ Don't use XML tag auto-indentation when '</' is to the right of the
+ cursor; allow auto-indentation when XML tag auto-closing is also
+ enabled.
+
+
2010-11-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* waf:
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2010-11-14 20:44:00 UTC (rev 5405)
+++ trunk/doc/geany.html 2010-11-15 13:06:11 UTC (rev 5406)
@@ -6,7 +6,7 @@
<meta name="generator" content="Docutils 0.4: http://docutils.sourceforge.net/" />
<title>Geany</title>
<meta name="authors" content="Enrico Tröger Nick Treleaven Frank Lanitz" />
-<meta name="date" content="2010-11-08" />
+<meta name="date" content="2010-11-11" />
<style type="text/css">
/*
@@ -139,7 +139,7 @@
<br />Nick Treleaven
<br />Frank Lanitz</td></tr>
<tr><th class="docinfo-name">Date:</th>
-<td>2010-11-08</td></tr>
+<td>2010-11-11</td></tr>
<tr><th class="docinfo-name">Version:</th>
<td>0.20</td></tr>
</tbody>
@@ -1246,6 +1246,9 @@
<dd>Similar to <em>Current chars</em> but the closing brace will be aligned to
match the indentation of the line with the opening brace.</dd>
</dl>
+<p>There is also XML-tag auto-indentation. This is enabled when the
+mode is more than just Basic, and is also controlled by a filetype
+setting - see <a class="reference" href="#xml-indent-tags">xml_indent_tags</a>.</p>
</div>
<div class="section">
<h3><a class="toc-backref" href="#id49" id="bookmarks" name="bookmarks">Bookmarks</a></h3>
@@ -4444,17 +4447,13 @@
</tbody>
</table>
</dd>
+</dl>
+<dl class="docutils" id="xml-indent-tags">
<dt>xml_indent_tags</dt>
-<dd><p class="first">If this setting is set to <em>true</em>, a new line after a line ending with an
+<dd>If this setting is set to <em>true</em>, a new line after a line ending with an
unclosed XML/HTML tag will be automatically indented. This only applies
to filetypes for which the HTML or XML lexer is used. Such filetypes have
-this setting in their system configuration files.</p>
-<div class="last note">
-<p class="first admonition-title">Note</p>
-<p class="last">This setting will not work if the <em>XML/HTML tag
-autocompletion</em> pref is set.</p>
-</div>
-</dd>
+this setting in their system configuration files.</dd>
</dl>
</div>
<div class="section">
@@ -6357,7 +6356,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2010-11-11 17:52 UTC.
+Generated on: 2010-11-15 13:01 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt 2010-11-14 20:44:00 UTC (rev 5405)
+++ trunk/doc/geany.txt 2010-11-15 13:06:11 UTC (rev 5406)
@@ -814,7 +814,11 @@
Similar to *Current chars* but the closing brace will be aligned to
match the indentation of the line with the opening brace.
+There is also XML-tag auto-indentation. This is enabled when the
+mode is more than just Basic, and is also controlled by a filetype
+setting - see `xml_indent_tags`_.
+
Bookmarks
^^^^^^^^^
@@ -3731,17 +3735,15 @@
1 Sort tags by appearance (line number)
===== =====================================
+.. _xml_indent_tags:
+
xml_indent_tags
If this setting is set to *true*, a new line after a line ending with an
unclosed XML/HTML tag will be automatically indented. This only applies
to filetypes for which the HTML or XML lexer is used. Such filetypes have
this setting in their system configuration files.
- .. note::
- This setting will not work if the *XML/HTML tag
- autocompletion* pref is set.
-
[build_settings] Section
````````````````````````
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2010-11-14 20:44:00 UTC (rev 5405)
+++ trunk/src/editor.c 2010-11-15 13:06:11 UTC (rev 5406)
@@ -1306,7 +1306,14 @@
{
gboolean need_close = FALSE;
gint end = sci_get_line_end_position(sci, line) - 1;
+ gint pos;
+ /* don't indent if there's a closing tag to the right of the cursor */
+ pos = sci_get_current_position(sci);
+ if (sci_get_char_at(sci, pos) == '<' &&
+ sci_get_char_at(sci, pos + 1) == '/')
+ return 0;
+
if (sci_get_char_at(sci, end) == '>' &&
sci_get_char_at(sci, end - 1) != '/')
{
@@ -1356,7 +1363,7 @@
/* HTML lexer "has braces" because of PHP and JavaScript. If get_brace_indent() did not
* recommend us to insert additional indent, we are probably not in PHP/JavaScript chunk and
* should make the XML-related check */
- if (additional_indent == 0 && !editor_prefs.auto_close_xml_tags &&
+ if (additional_indent == 0 &&
(sci_get_lexer(sci) == SCLEX_HTML ||
sci_get_lexer(sci) == SCLEX_XML) &&
editor->document->file_type->priv->xml_indent_tags)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list