As stated on IRC, this problem arises when my source file contains non-UTF8 characters.
Aporia will then report an error such as this here on the terminal:
Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed
My file in question had something like this here as part of itself:
@default_colour = 'green' # gehört zwar nit dazu, aber zu reset.
Note the "ö" character, which is the german umlaut for "oe".
If that character is removed, the same file loads fine in Aporia.
This is not a important issue, but I regard it still as a bug in Aporia.
I propose to fix this in either (or all) of the following ways:
gedit is doing something similar, it display a red bar on the top and
tells you that the encoding is not as expected. And then you can
force load it, or assume another encoding. Aporia could at least
flash a little red warning bar or something to indicate this problem
of a wrongful encoding. (Let's keep it simple - just a little warning
box text with red background and black font colours perhaps.
This should be very easy to do in GTK.)
For instance, the Unix utilty "file" reports this about the file in question:
question_answer.rb: Ruby script, ISO-8859 text
By the way, perhaps Aporia could get a new menu option, something
like Encoding, or "-> Set Encoding (to: Unicode, ISO etc..)
This is what Geany is doing.
Bluefish too, in a way. At least the file is loaded.
In my opinion, perhaps the default way for Aporia should be to
try to load the given file, even if there are errors, because right
now it refuses to load the whole file even if there is an error.