[geany/geany] a17e37: Test against the lexer instead of the filetype when computing

Alexander Eberspächer git-noreply at xxxxx
Fri Aug 10 09:34:56 UTC 2012


Branch:      refs/heads/master
Author:      Alexander Eberspächer <alex.eberspaecher at gmail.com>
Committer:   Alexander Eberspächer <alex.eberspaecher at gmail.com>
Date:        Fri, 10 Aug 2012 09:34:56
Commit:      a17e37bcd84c642136614c6e60a62a4c1bd7604a
             https://github.com/geany/geany/commit/a17e37bcd84c642136614c6e60a62a4c1bd7604a

Log Message:
-----------
Test against the lexer instead of the filetype when computing
indentation. This fixes Cython indentation.


Modified Paths:
--------------
    src/editor.c

Modified: src/editor.c
10 files changed, 8 insertions(+), 2 deletions(-)
===================================================================
@@ -1401,10 +1401,16 @@ static gint get_indent_size_after_line(GeanyEditor *editor, gint line)
 		gint additional_indent = 0;
 
 		if (lexer_has_braces(sci))
+		{
 			additional_indent = iprefs->width * get_brace_indent(sci, line);
+		}
 		else
-		if (editor->document->file_type->id == GEANY_FILETYPES_PYTHON)
-			additional_indent = iprefs->width * get_python_indent(sci, line);
+		{
+			/* Instead of testing the filetype directly, test for the lexer being
+			* used. Otherwise Cython indentation will break. */
+			if (sci_get_lexer(sci) == SCLEX_PYTHON)
+				additional_indent = iprefs->width * get_python_indent(sci, line);
+		}
 
 		/* 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


@@ Diff output truncated at 100000 characters. @@


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



More information about the Commits mailing list