X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Foutput-viewer.c;h=0372e14cf9325df0a7a62604229b329784ca073a;hb=782d25daa41a6e267b0c7c6482835fac12964bbc;hp=62dc85f1c2a4147c9cb1cff7b72059c60babf67d;hpb=70c7494a0b0a9e6ce90c271f65095bc474b775ee;p=pspp-builds.git diff --git a/src/ui/gui/output-viewer.c b/src/ui/gui/output-viewer.c index 62dc85f1..0372e14c 100644 --- a/src/ui/gui/output-viewer.c +++ b/src/ui/gui/output-viewer.c @@ -28,6 +28,8 @@ #include #include +#include "xalloc.h" + struct output_viewer { struct editor_window parent; @@ -46,8 +48,8 @@ cancel_urgency (GtkWindow *window, gpointer data) static struct output_viewer *the_output_viewer = NULL; -int viewer_length = -1; -int viewer_width = -1; +int viewer_length = 16; +int viewer_width = 59; /* Callback for the "delete" action (clicking the x on the top right hand corner of the window) */ @@ -196,7 +198,7 @@ void reload_viewer (struct output_viewer *ov) { GtkTextIter end_iter; - char line[OUTPUT_LINE_WIDTH]; + static char *line = NULL; GtkTextMark *mark ; gboolean chars_inserted = FALSE; @@ -211,12 +213,14 @@ reload_viewer (struct output_viewer *ov) } } + line = xrealloc (line, sizeof (char) * (viewer_width + 1)); + gtk_text_buffer_get_end_iter (ov->buffer, &end_iter); mark = gtk_text_buffer_create_mark (ov->buffer, NULL, &end_iter, TRUE); /* Read in the next lot of text */ - while (fgets (line, OUTPUT_LINE_WIDTH, ov->fp) != NULL) + while (fgets (line, viewer_width + 1, ov->fp) != NULL) { chars_inserted = TRUE; gtk_text_buffer_insert (ov->buffer, &end_iter, line, -1);