diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:12 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:12 +0200 |
commit | e50482f994b6ebcce864a412111d376e99205cdb (patch) | |
tree | ff3192c6aaf213c4922521bed988e4ed4147f537 /app/wlib/gtklib/text.c | |
parent | d3897ce090dbeb220ed2c782f095597e417cf3cc (diff) | |
parent | b623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff) |
Update upstream source from tag 'upstream/5.2.0Beta2.1'
Update to upstream version '5.2.0Beta2.1'
with Debian dir 1576f25f4c1496abfed44af31ead67d32c7be650
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; } /** |