@techee commented on this pull request.
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; + } + }
It's actually a simpler code when we also detect the indented `[` and `#` so let's leave it that way. Interesting that it's valid for GKeyFile - they are definitely not valid for the Scintilla lexer.
I just re-pushed the fix for the patch - I used the `sci_get_line_end_position()` which is definitely better and removed the comment for `#` as the decision seems to be not to have the `##` comments for the original comments. The rest is just my original patch - I find it simple enough but maybe there's a better way to write it or there's maybe something I'm still overlooking.