@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;
+			}
+		}

Maybe something like this? ⚠️ ATTENTION: this is entirely not reviewed or tested in any way.

⬇️ Suggested change
-		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;
-			}
-		}
+		gint pos_start = sci_get_position_from_line(sci, line);
+		gint pos_end = sci_get_line_end_position(sci, line);
+		gint pos_indent = SSM(sci, SCI_GETLINEINDENTPOSITION, line, 0);
+
+		if (pos_indent < pos_end && sci_get_char_at(sci, pos_start) != '#' &&
+		    sci_get_char_at(sci, pos_indent) != '[')
+			sci_insert_text(sci, pos_start, "#");


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/1336094773@github.com>