SF.net SVN: geany: [2392] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Mon Mar 24 13:09:30 UTC 2008
Revision: 2392
http://geany.svn.sourceforge.net/geany/?rev=2392&view=rev
Author: ntrel
Date: 2008-03-24 06:09:29 -0700 (Mon, 24 Mar 2008)
Log Message:
-----------
Fix Python auto-indentation when line endings are set to CR/LF.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-03-23 16:43:01 UTC (rev 2391)
+++ trunk/ChangeLog 2008-03-24 13:09:29 UTC (rev 2392)
@@ -1,3 +1,9 @@
+2008-03-24 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/editor.c:
+ Fix Python auto-indentation when line endings are set to CR/LF.
+
+
2008-03-23 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* data/filetypes.common, doc/geany.txt, doc/geany.html,
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-03-23 16:43:01 UTC (rev 2391)
+++ trunk/src/editor.c 2008-03-24 13:09:29 UTC (rev 2392)
@@ -436,6 +436,24 @@
}
+static void check_python_indent(gint idx, gint pos)
+{
+ document *doc = &doc_list[idx];
+ gint last_char = pos - utils_get_eol_char_len(idx) - 1;
+
+ /* add extra indentation for Python after colon */
+ if (sci_get_char_at(doc->sci, last_char) == ':' &&
+ sci_get_style_at(doc->sci, last_char) == SCE_P_OPERATOR)
+ {
+ /* creates and inserts one tabulator sign or
+ * whitespace of the amount of the tab width */
+ gchar *text = get_whitespace(editor_prefs.tab_width, doc->use_tabs);
+ sci_add_text(doc->sci, text);
+ g_free(text);
+ }
+}
+
+
static void on_new_line_added(gint idx)
{
ScintillaObject *sci = doc_list[idx].sci;
@@ -448,20 +466,9 @@
get_indent(&doc_list[idx], pos, FALSE);
sci_add_text(sci, indent);
- if (editor_prefs.indent_mode > INDENT_BASIC)
- {
- /* add extra indentation for Python after colon */
- if (FILETYPE_ID(doc_list[idx].file_type) == GEANY_FILETYPES_PYTHON &&
- sci_get_char_at(sci, pos - 2) == ':' &&
- sci_get_style_at(sci, pos - 2) == SCE_P_OPERATOR)
- {
- /* creates and inserts one tabulator sign or
- * whitespace of the amount of the tab width */
- gchar *text = get_whitespace(editor_prefs.tab_width, doc_list[idx].use_tabs);
- sci_add_text(sci, text);
- g_free(text);
- }
- }
+ if (editor_prefs.indent_mode > INDENT_BASIC &&
+ FILETYPE_ID(doc_list[idx].file_type) == GEANY_FILETYPES_PYTHON)
+ check_python_indent(idx, pos);
}
if (editor_prefs.complete_snippets)
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