diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:00 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:00 +0200 |
commit | b623f5953691b2a0614e6f1f4def86bdbb9a4113 (patch) | |
tree | 18102bd36f7e22eb2ba2b9f880e4cb29346f4cb8 /app/wlib/gtklib/text.c | |
parent | 359b557176b9bb2ff1aed2082641eed39c358d0d (diff) |
New upstream version 5.2.0Beta2.1upstream/5.2.0Beta2.1
Diffstat (limited to 'app/wlib/gtklib/text.c')
-rw-r--r-- | app/wlib/gtklib/text.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/app/wlib/gtklib/text.c b/app/wlib/gtklib/text.c index f7ba288..0812ace 100644 --- a/app/wlib/gtklib/text.c +++ b/app/wlib/gtklib/text.c @@ -98,6 +98,8 @@ void wTextAppend(wText_p bt, { GtkTextBuffer *tb; GtkTextIter ti1; + GtkTextMark *tm; + if (bt->text == 0) { abort(); @@ -109,6 +111,18 @@ void wTextAppend(wText_p bt, // append to end of buffer gtk_text_buffer_get_end_iter(tb, &ti1); gtk_text_buffer_insert(tb, &ti1, text, -1); + + if ( bt->option & BT_TOP ) { + // and scroll to start of text + gtk_text_buffer_get_start_iter(tb, &ti1); + } else { + // and scroll to end of text + gtk_text_buffer_get_end_iter(tb, &ti1); + } + tm = gtk_text_buffer_create_mark(tb, NULL, &ti1, TRUE ); + gtk_text_view_scroll_mark_onscreen (GTK_TEXT_VIEW(bt->text), tm ); + gtk_text_buffer_delete_mark( tb, tm ); + bt->changed = FALSE; } @@ -116,7 +130,7 @@ void wTextAppend(wText_p bt, * Get the text from a text buffer in system codepage * The caller is responsible for free'ing the allocated storage. * - * \todo handling of return from gtkConvertOutput can be improved + * Dont convert from UTF8 * * \param bt IN the text widget * \return pointer to the converted text @@ -135,8 +149,8 @@ static char *wlibGetText(wText_p bt) tb = gtk_text_view_get_buffer(GTK_TEXT_VIEW(bt->text)); gtk_text_buffer_get_bounds(tb, &ti1, &ti2); cp = gtk_text_buffer_get_text(tb, &ti1, &ti2, FALSE); - cp1 = wlibConvertOutput(cp); - res = strdup(cp1); + //cp1 = wlibConvertOutput(cp); + res = strdup(cp); g_free(cp); return res; } @@ -375,7 +389,7 @@ wBool_t wTextPrint( * Get the length of text * * \param bt IN the text widget - * \return length of string + * \return length of string including terminating \0 */ int wTextGetSize(wText_p bt) @@ -383,7 +397,7 @@ int wTextGetSize(wText_p bt) char *cp = wlibGetText(bt); int len = strlen(cp); free(cp); - return len; + return len + 1; } /** |