Relevant code is in 
[`geanylua/glspi_doc.c`](https://github.com/geany/geany-plugins/blob/master/geanylua/glspi_doc.c#L95-L124).
  I don't see why it doesn't work.
```C
/* Actvate and focus the specified document */
static gint glspi_activate(lua_State* L)
{
        gint idx=-1;
        if (lua_gettop(L)>0) {
                if (lua_isnumber(L,1)) {
                        idx=(lua_tonumber(L,1));
                        if (idx<0) { /* Negative number refers to (absolute) 
GtkNotebook index */
                                idx=(0-idx)-1;
                                if (idx>=gtk_notebook_get_n_pages(NOTEBOOK)) { 
idx=-1;}
                        } else { /* A positive number refers to the 
geany->documents_array index */
                                idx=doc_idx_to_tab_idx(idx-1);
                        }

                } else {
                        if (lua_isstring(L,1)) {
                                
idx=doc_idx_to_tab_idx(filename_to_doc_idx(lua_tostring(L, 1)));
                        } else {
                                if (!lua_isnil(L,1)) { return 
FAIL_STR_OR_NUM_ARG(1); }
                        }
                }
        }
        if (idx>=0) {
                if (idx!=gtk_notebook_get_current_page(NOTEBOOK)) {
                        gtk_notebook_set_current_page(NOTEBOOK, idx);
                }
        }
        lua_pushboolean(L, (idx>0));
        return 1;
}
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1229#issuecomment-1454293538
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/issues/1229/[email protected]>

Reply via email to