@b4n commented on this pull request.


In src/ui_utils.c:

> +		gint pos_start = sci_get_position_from_line(sci, line);
+		gint pos_end = sci_get_position_from_line(sci, line + 1);
+		gint pos;
+
+		for (pos = pos_start; pos < pos_end; pos++)
+		{
+			gchar c = sci_get_char_at(sci, pos);
+			if (c == '[')
+				break;
+			if (!isspace(c))
+			{
+				sci_insert_text(sci, pos_start, "#");
+				break;
+			}
+		}

but again, your code doesn't detect empty lines where we shouldn't insert # which is the purpose of the isspace() test in my code.

The intent of if (pos_indent < pos_end) is to detect that (again, not tested whether that actually works, and what those positions actually are)

I also think we don't really have to check for the indented [ or # since these aren't valid conf files.

Aren't they? So you say the only case that matters for checking whitespaces is whether it makes a blank line?
That would make the code look like that:

		if (pos_indent < pos_end)
		{
			gchar c = sci_get_char_at(sci, pos_start);
			if (c != '#' && c != '[')
				sci_insert_text(sci, pos_start, "#");
		}

Or indeed your loop, whichever you like best.


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/pull/3413/review/1336100678@github.com>