Commit e2b23f6d authored by Victor Ananjevsky's avatar Victor Ananjevsky

fix loading text from file in text-info dialog

parent 87d4f424
...@@ -358,7 +358,7 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data) ...@@ -358,7 +358,7 @@ handle_stdin (GIOChannel * channel, GIOCondition condition, gpointer data)
static void static void
fill_buffer_from_file () fill_buffer_from_file ()
{ {
GtkTextIter iter, end; GtkTextIter iter;
#ifdef HAVE_SOURCEVIEW #ifdef HAVE_SOURCEVIEW
GtkSourceLanguage *lang; GtkSourceLanguage *lang;
#endif #endif
...@@ -385,26 +385,19 @@ fill_buffer_from_file () ...@@ -385,26 +385,19 @@ fill_buffer_from_file ()
gchar *utftext = gchar *utftext =
g_convert_with_fallback (buf, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL, NULL); g_convert_with_fallback (buf, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL, NULL);
if (options.text_data.formatted && !options.common_data.editable) if (options.text_data.formatted && !options.common_data.editable)
gtk_text_buffer_insert_markup (GTK_TEXT_BUFFER (text_buffer), &end, utftext, -1); gtk_text_buffer_insert_markup (GTK_TEXT_BUFFER (text_buffer), &iter, utftext, -1);
else else
gtk_text_buffer_insert (GTK_TEXT_BUFFER (text_buffer), &end, utftext, -1); gtk_text_buffer_insert (GTK_TEXT_BUFFER (text_buffer), &iter, utftext, -1);
g_free (utftext); g_free (utftext);
} }
else else
{ {
if (options.text_data.formatted && !options.common_data.editable) if (options.text_data.formatted && !options.common_data.editable)
gtk_text_buffer_insert_markup (GTK_TEXT_BUFFER (text_buffer), &end, buf, -1); gtk_text_buffer_insert_markup (GTK_TEXT_BUFFER (text_buffer), &iter, buf, -1);
else else
gtk_text_buffer_insert (GTK_TEXT_BUFFER (text_buffer), &end, buf, -1); gtk_text_buffer_insert (GTK_TEXT_BUFFER (text_buffer), &iter, buf, -1);
} }
g_free (buf);
/* We had a newline in the buffer to begin with. (The buffer always contains
* a newline, so we delete to the end of the buffer to clean up.
*/
gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (text_buffer), &end);
gtk_text_buffer_delete (GTK_TEXT_BUFFER (text_buffer), &iter, &end);
gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (text_buffer), FALSE);
#ifdef HAVE_SOURCEVIEW #ifdef HAVE_SOURCEVIEW
if (options.source_data.lang) if (options.source_data.lang)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment