[Github-comments] [geany/geany] Improve goto-symbols popup (#1445)

Thomas Martitz notifications at xxxxx
Fri Nov 16 18:21:10 UTC 2018


kugel- commented on this pull request.



> +
+	/* The return value shall have exactly the same size as the input. If the input is a
+	 * GStrv (last element is NULL), the output will follow suit. */
+	if (!num)
+		num = g_strv_length(file_names);
+	/* Always include a terminating NULL, enables easy freeing with g_strfreev() */
+	names = g_new0(gchar *, num + 1);
+
+	prefix = utils_strv_find_common_prefix(file_names, num);
+	/* First: determine the common prefix, that will be stripped.
+	 * Don't strip single-letter prefixes, such as '/' */
+	prefix_len = 0;
+	if (NZV(prefix) && prefix[1])
+	{
+		/* Only strip directory components, include trailing '/' */
+		start = strrchr(prefix, G_DIR_SEPARATOR);

Meh, what's the point G_DIR_SEPARATOR if you need to handle both. Also, what about legitimate paths that contain the other slash (e.g. a file can contain the \ character on linux, not sure if the same is true for / on Windows).

Are you sure we don't have problems with this elsewhere inside Geany? I.e. is this something we support or not?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1445#discussion_r234302628
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20181116/0dca469a/attachment.html>


More information about the Github-comments mailing list