@b4n requested changes on this pull request.

LGTM, see inline comments.

Apart from that, I was kind of disappointed that the "goto file" only lists Geany open documents rather than the project's documents -- maybe you'd like to add that?
Also, I hoped to be able to go to a specific file's line, not only in the current file -- but that's probably less useful in practice.


In projectorganizer/src/prjorg-goto-anywhere.c:

> +	GPtrArray *arr = g_ptr_array_new_full(0, (GDestroyNotify)prjorg_goto_symbol_free);
+	gint lineno = atoi(line_str);
+	gint linenum = sci_get_line_count(doc->editor->sci);
+	guint i;
+
+	for (i = 0; i < 4; i++)
+	{
+		PrjorgGotoSymbol *sym = g_new0(PrjorgGotoSymbol, 1);
+
+		sym->file_name = utils_get_utf8_from_locale(doc->real_path);
+		sym->icon = _ICON_OTHER;
+
+		switch (i)
+		{
+			case 0:
+				sym->name = g_strdup(_("line typed above"));

This string and the ones below are probably worth a translator comment, and possibly even a translation context.


In projectorganizer/src/prjorg-goto-anywhere.c:

> +		}
+		pos = new_pos;
+	}
+	end_pos = pos;
+
+	if (start_pos == end_pos)
+		return NULL;
+
+	return sci_get_contents_range(sci, start_pos, end_pos);
+}
+
+
+static void goto_panel_query(const gchar *query_type, gboolean prefill)
+{
+	GeanyDocument *doc = document_get_current();
+	gint pos = sci_get_current_position(doc->editor->sci);

⚠️ dereferencing doc which is tested against NULL further down. And the NULL check makes sense in the (unlikely) case no document is open.


In projectorganizer/src/prjorg-goto-panel.c:

> + * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* This file contains mostly stolen code from the Colomban Wendling's Commander

You're welcome 😆


In projectorganizer/src/prjorg-goto-panel.c:

> +		gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &x, &dummy);
+	}
+	return gtk_icon_theme_load_icon(icon_theme, icon_name, x, 0, NULL);
+}
+
+
+static GdkPixbuf *get_icon_pixbuf(gint icon)
+{
+	if (!geany_icons[_ICON_CLASS].pixbuf)
+	{
+		guint i;
+		for (i = 0; i < G_N_ELEMENTS(geany_icons); i++)
+			geany_icons[i].pixbuf = get_tag_icon(geany_icons[i].icon_name);
+	}
+
+	if (icon < _N_ICONS)
⬇️ Suggested change
-	if (icon < _N_ICONS)
+	if (icon < G_N_ELEMENTS(geany_icons))

maybe?


In projectorganizer/src/prjorg-goto-panel.c:

> +
+		case GDK_KEY_Return:
+		case GDK_KEY_KP_Enter:
+		case GDK_KEY_ISO_Enter:
+			tree_view_activate_focused_row(GTK_TREE_VIEW(panel_data.tree_view));
+			return TRUE;
+
+		case GDK_KEY_Page_Up:
+		case GDK_KEY_Page_Down:
+		case GDK_KEY_KP_Page_Up:
+		case GDK_KEY_KP_Page_Down:
+		{
+			gboolean up = event->keyval == GDK_KEY_Page_Up || event->keyval == GDK_KEY_KP_Page_Up;
+			tree_view_move_focus(GTK_TREE_VIEW(panel_data.tree_view),
+				GTK_MOVEMENT_PAGES, up ? -1 : 1);
+		  return TRUE;
⬇️ Suggested change
-		  return TRUE;
+			return TRUE;

In projectorganizer/src/prjorg-goto-panel.c:

> +
+	if (!symbols)
+		return ret;
+
+	tf_strv = g_strsplit_set(filter, " ", -1);
+
+	for (i = 0; i < symbols->len && j < 100; i++)
+	{
+		PrjorgGotoSymbol *symbol = symbols->pdata[i];
+		gchar *normalized_name = g_utf8_normalize(symbol->name, -1, G_NORMALIZE_ALL);
+		gboolean filtered = FALSE;
+		gchar **val;
+
+		foreach_strv(val, tf_strv)
+		{
+			gchar *normalized_val = g_utf8_normalize(*val, -1, G_NORMALIZE_ALL);

Maybe you could normalize the filter before splitting it?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany-plugins/pull/1341/review/2026639258@github.com>