[geany/geany-plugins] e76076: xmlsnippets: Drop use of the most obvious deprecated Geany API

Colomban Wendling git-noreply at xxxxx
Thu Jun 9 08:55:03 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 20 Feb 2016 22:02:00 UTC
Commit:      e76076d052738c9cf4ce7ed29b0d01cd5587e9cf
             https://github.com/geany/geany-plugins/commit/e76076d052738c9cf4ce7ed29b0d01cd5587e9cf

Log Message:
-----------
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(-)
===================================================================
@@ -66,7 +66,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 == '>')
 	{
@@ -81,13 +81,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))
 				{
@@ -102,12 +103,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