SF.net SVN: geany: [1046] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Dec 3 23:05:30 UTC 2006


Revision: 1046
          http://svn.sourceforge.net/geany/?rev=1046&view=rev
Author:   eht16
Date:     2006-12-03 15:05:29 -0800 (Sun, 03 Dec 2006)

Log Message:
-----------
Made handle_xml() static.
Fixed wrong XML auto completion in PHP files when inserting '>', thanks to Bob Doan for reporting.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/sci_cb.c
    trunk/src/sci_cb.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-12-03 22:43:09 UTC (rev 1045)
+++ trunk/ChangeLog	2006-12-03 23:05:29 UTC (rev 1046)
@@ -10,6 +10,10 @@
    fold point is unfolded.
  * src/msgwindow.c: Applied patch from Bob Doan to ignore libtool
                     messages when parsing the output of make (thanks).
+ * src/sci_cb.c, src/sci_cb.h:
+   Made handle_xml() static.
+   Fixed wrong XML auto completion in PHP files when inserting '>',
+   thanks to Bob Doan for reporting.
 
 
 2006-12-02  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/src/sci_cb.c
===================================================================
--- trunk/src/sci_cb.c	2006-12-03 22:43:09 UTC (rev 1045)
+++ trunk/src/sci_cb.c	2006-12-03 23:05:29 UTC (rev 1046)
@@ -49,6 +49,7 @@
 
 
 static void on_new_line_added(ScintillaObject *sci, gint idx);
+static gboolean handle_xml(ScintillaObject *sci, gchar ch, gint idx);
 
 
 // calls the edit popup menu in the editor
@@ -200,7 +201,7 @@
 				case '>':
 				case '/':
 				{	// close xml-tags
-					sci_cb_handle_xml(sci, nt->ch);
+					handle_xml(sci, nt->ch, idx);
 					break;
 				}
 				case '(':
@@ -1036,8 +1037,7 @@
  * @param ch The character we are dealing with, currently only works with the '>' character
  * @return True if handled, false otherwise
  */
-
-gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch)
+static gboolean handle_xml(ScintillaObject *sci, gchar ch, gint idx)
 {
 	gint lexer = SSM(sci, SCI_GETLEXER, 0, 0);
 	gint pos, min;
@@ -1048,9 +1048,18 @@
 	if (! app->pref_editor_auto_close_xml_tags || (lexer != SCLEX_HTML && lexer != SCLEX_XML))
 		return FALSE;
 
+	pos = sci_get_current_position(sci);
 
+	// return if we are in PHP but not in a string or outside of <? ?> tags
+	if (doc_list[idx].file_type->id == GEANY_FILETYPES_PHP)
+	{
+		gint style = sci_get_style_at(sci, pos);
+		if (style != SCE_HPHP_SIMPLESTRING && style != SCE_HPHP_HSTRING &&
+			style <= SCE_HPHP_OPERATOR && style >= SCE_HPHP_DEFAULT)
+			return FALSE;
+	}
+
 	// if ch is /, check for </, else quit
-	pos = sci_get_current_position(sci);
 	if (ch == '/' && sci_get_char_at(sci, pos - 2) != '<')
 		return FALSE;
 

Modified: trunk/src/sci_cb.h
===================================================================
--- trunk/src/sci_cb.h	2006-12-03 22:43:09 UTC (rev 1045)
+++ trunk/src/sci_cb.h	2006-12-03 23:05:29 UTC (rev 1046)
@@ -64,8 +64,6 @@
 
 void sci_cb_show_macro_list(ScintillaObject *sci);
 
-gboolean sci_cb_handle_xml(ScintillaObject *sci, gchar ch);
-
 /* Reads the word at given cursor position and writes it into the given buffer. The buffer will be
  * NULL terminated in any case, even when the word is truncated because wordlen is too small.
  * position can be -1, then the current position is used. */


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