Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 21 Feb 2016 00:13:23 UTC Commit: 3e51b0104503f240817b8d015374c3d4837caf79 https://github.com/geany/geany-plugins/commit/3e51b0104503f240817b8d015374c3...
Log Message: ----------- geanylua: Drop use of the most obvious deprecated Geany API
Modified Paths: -------------- geanylua/glspi_doc.c geanylua/glspi_sci.c
Modified: geanylua/glspi_doc.c 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -51,7 +51,7 @@ static gint filename_to_doc_idx(const gchar*fn) { if (fn && *fn) { guint i; - documents_foreach(i) + foreach_document(i) { if fncmp(fn,documents[i]->file_name) {return i; } } @@ -173,7 +173,7 @@ static gint glspi_documents(lua_State *L) static gint glspi_count(lua_State* L) { guint i, n=0; - documents_foreach(i) + foreach_document(i) { if (documents[i]->is_valid){n++;} } @@ -225,7 +225,7 @@ static gint glspi_open(lua_State* L) } } if (!fn) { - status=document_reload_file(documents[idx],NULL) ? idx : -1; + status=document_reload_force(documents[idx],NULL) ? idx : -1; } else { guint len=geany->documents_array->len; GeanyDocument*doc=document_open_file(fn,FALSE,NULL,NULL); @@ -235,7 +235,7 @@ static gint glspi_open(lua_State* L) /* if len doesn't change, it means we are reloading an already open file */ /* ntrel: actually, len can stay the same when reusing invalid document slots. */ idx=document_get_current()->index; - status=document_reload_file(documents[idx],NULL) ? idx : -1; + status=document_reload_force(documents[idx],NULL) ? idx : -1; } } push_number(L,status+1);
Modified: geanylua/glspi_sci.c 26 lines changed, 6 insertions(+), 20 deletions(-) =================================================================== @@ -19,16 +19,9 @@ static gint glspi_text(lua_State* L)
if (!doc) { return 0; } if (0 == lua_gettop(L)) { /* Called with no args, GET the current text */ - gint len = sci_get_length(doc->editor->sci); - gchar *txt = NULL; - if (len>0) { - txt = g_malloc0((guint)len+2); - sci_get_text(doc->editor->sci, len+1, txt); - lua_pushstring(L, (const gchar *) txt); - g_free(txt); - } else { - lua_pushstring(L, ""); - } + gchar *txt = sci_get_contents(doc->editor->sci, -1); + lua_pushstring(L, txt ? txt : ""); + g_free(txt); return 1; } else { /* Called with one arg, SET the current text */ const gchar*txt; @@ -48,16 +41,9 @@ static gint glspi_selection(lua_State* L)
DOC_REQUIRED if (0 == lua_gettop(L)) { /* Called with no args, GET the selection */ - gint len = sci_get_selected_text_length(doc->editor->sci); - gchar *txt = NULL; - if (len>0) { - txt = g_malloc0((guint)(len+1)); - sci_get_selected_text(doc->editor->sci, txt); - lua_pushstring(L, (const gchar *) txt); - g_free(txt); - } else { - lua_pushstring(L, ""); - } + gchar *txt = sci_get_selection_contents(doc->editor->sci); + lua_pushstring(L, txt ? txt : ""); + g_free(txt); return 1; } else { /* Called with one arg, SET the selection */ const gchar*txt=NULL;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org