pidgin.next.minor: ce1bc8ab: Fix a bug that's bothered me for a while...

markdoliner at pidgin.im markdoliner at pidgin.im
Wed Jan 28 05:15:41 EST 2009


-----------------------------------------------------------------
Revision: ce1bc8ab397eb81194a3c1763710e9908dd8bf76
Ancestor: 40ae5e59927eadc96dc7575a62370d0a2eb18235
Author: markdoliner at pidgin.im
Date: 2009-01-28T09:57:19
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/ce1bc8ab397eb81194a3c1763710e9908dd8bf76

Modified files:
        pidgin/gtkstatusbox.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- pidgin/gtkstatusbox.c	1c240a08be60e8a2d1ee1c4b4de42639f3a27577
+++ pidgin/gtkstatusbox.c	b0a46292fbf01375e0ccddefb43358a7f337202d
@@ -2555,6 +2555,22 @@ static void update_size(PidginStatusBox 
 			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 */


More information about the Commits mailing list