Mercurial > pidgin
changeset 25937:17168b8379f2
Fix a bug that's bothered me for a while. When pressing shift+enter in
the status box to insert a newline, grow the box an extra line.
Previously it didn't increase the height until you started typing, so
you'd see the text scroll when you hit enter, then you'd see stuff jump
around when you typed text.
So the auto-expanding is a little less sucky now.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 28 Jan 2009 09:57:19 +0000 |
parents | 2cf7d6a20e68 |
children | 4c610616e018 |
files | pidgin/gtkstatusbox.c |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkstatusbox.c Wed Jan 28 08:57:55 2009 +0000 +++ b/pidgin/gtkstatusbox.c Wed Jan 28 09:57:19 2009 +0000 @@ -2555,6 +2555,22 @@ break; } while (gtk_text_view_forward_display_line(GTK_TEXT_VIEW(status_box->imhtml), &iter)); + /* + * This check fixes the case where the last character entered is a + * newline (shift+return). For some reason the + * gtk_text_view_forward_display_line() function doesn't treat this + * like a new line, and so we think the input box only needs to be + * two lines instead of three, for example. So we check if the + * last character was a newline and add some extra height if so. + */ + if (wrapped_lines <= 4 + && gtk_text_iter_backward_char(&iter) + && gtk_text_iter_get_char(&iter) == '\n') + { + gtk_text_view_get_iter_location(GTK_TEXT_VIEW(status_box->imhtml), &iter, &oneline); + height += oneline.height; + } + lines = gtk_text_buffer_get_line_count(buffer); /* Show a maximum of 4 lines */