Add workaround for display problem in Message window:

Truncate displayed string at 1024 bytes if it is longer.      


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2153 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2008-01-09 13:36:22 +00:00
parent 2ff8416767
commit 9f151a3c1c
2 changed files with 15 additions and 1 deletions

View File

@ -6,6 +6,9 @@
Add GeanyWrapLabel (subclass of GtkLabel) to wrap text at any width.
Use GeanyWrapLabel in preferences dialog and plugin manager dialog
to save a lot of space and improve layout of descriptive texts.
* src/msgwindow.c:
Add workaround for display problem in Message window:
Truncate displayed string at 1024 bytes if it is longer.
2008-01-06 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -275,13 +275,24 @@ void msgwin_msg_add(gint msg_color, gint line, gint idx, const gchar *string)
{
GtkTreeIter iter;
const GdkColor *color = get_color(msg_color);
gchar *tmp;
if (! ui_prefs.msgwindow_visible) msgwin_show_hide(TRUE);
// work around a strange problem when adding very long lines(greater than 4000 bytes)
// cut the string to a maximum of 1024 bytes and discard the rest
/// TODO find the real cause for the display problem / if it is GtkTreeView file a bug report
if (strlen(string) > 1024)
tmp = g_strndup(string, 1024);
else
tmp = g_strdup(string);
gtk_list_store_append(msgwindow.store_msg, &iter);
gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, idx, 2, color, 3, string, -1);
gtk_list_store_set(msgwindow.store_msg, &iter, 0, line, 1, idx, 2, color, 3, tmp, -1);
gtk_widget_set_sensitive(lookup_widget(app->window, "next_message1"), TRUE);
g_free(tmp);
}