[geany/geany-plugins] 59c58b: Merge pull request #369 from b4n/xmlsnippets/less-deprecated

Jiří Techet git-noreply at xxxxx
Thu Jun 9 08:54:56 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Thu, 09 Jun 2016 08:54:56 UTC
Commit:      59c58bcc9627631dee214ef7792b28de7d7cd677
             https://github.com/geany/geany-plugins/commit/59c58bcc9627631dee214ef7792b28de7d7cd677

Log Message:
-----------
Merge pull request #369 from b4n/xmlsnippets/less-deprecated

xmlsnippets: Drop use of the most obvious deprecated Geany API


Modified Paths:
--------------
    xmlsnippets/src/plugin.c

Modified: xmlsnippets/src/plugin.c
13 lines changed, 8 insertions(+), 5 deletions(-)
===================================================================
@@ -65,7 +65,7 @@ static gboolean editor_notify_cb(GObject *object, GeanyEditor *editor,
 								SCNotification *nt, gpointer data)
 {
 	gint lexer, pos, style, min, size;
-	gchar sel[512];
+	gboolean handled = FALSE;
 
 	if (nt->nmhdr.code == SCN_CHARADDED && nt->ch == '>')
 	{
@@ -80,13 +80,14 @@ static gboolean editor_notify_cb(GObject *object, GeanyEditor *editor,
 			{
 				CompletionInfo c;
 				InputInfo i;
+				gchar *sel;
 
 				/* Grab the last 512 characters or so */
-				min = pos - sizeof(sel);
+				min = pos - 512;
 				if (min < 0) min = 0;
 				size = pos - min;
 
-				sci_get_text_range(editor->sci, min, pos, sel);
+				sel = sci_get_contents_range(editor->sci, min, pos);
 
 				if (get_completion(editor, sel, size, &c, &i))
 				{
@@ -101,12 +102,14 @@ static gboolean editor_notify_cb(GObject *object, GeanyEditor *editor,
 					sci_scroll_caret(editor->sci);
 
 					g_free((gchar *)c.completion);
-					return TRUE;
+					handled = TRUE;
 				}
+
+				g_free(sel);
 			}
 		}
 	}
-	return FALSE;
+	return handled;
 }
 
 #endif



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list