comparison pidgin/gtkconv.c @ 22153:8f78d223d24e

Fix the bug where removing the typing notification would cause the text to scroll *up* by 2 pixels. I have also added a define 'RESERVE_LINE' which will always reserve a blank line at the end (of the buffer, not of the view) for the typing notification. We can switch to using that if people use it and like it better, (or hate it less ;) )
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 18 Jan 2008 22:40:33 +0000
parents 52d7368fdc1c
children f577201bf30f
comparison
equal deleted inserted replaced
22152:6e2dc21a33cb 22153:8f78d223d24e
3426 gtk_text_buffer_get_iter_at_mark(buffer, &start, stmark); 3426 gtk_text_buffer_get_iter_at_mark(buffer, &start, stmark);
3427 gtk_text_buffer_get_iter_at_mark(buffer, &end, enmark); 3427 gtk_text_buffer_get_iter_at_mark(buffer, &end, enmark);
3428 gtk_text_buffer_delete_mark(buffer, stmark); 3428 gtk_text_buffer_delete_mark(buffer, stmark);
3429 gtk_text_buffer_delete_mark(buffer, enmark); 3429 gtk_text_buffer_delete_mark(buffer, enmark);
3430 gtk_text_buffer_delete(buffer, &start, &end); 3430 gtk_text_buffer_delete(buffer, &start, &end);
3431 } else if (message && *message == '\n' && !*(message + 1)) 3431 } else if (message && *message == '\n' && message[1] == ' ' && message[2] == '\0')
3432 message = NULL; 3432 message = NULL;
3433
3434 #ifdef RESERVE_LINE
3435 if (!message)
3436 message = "\n "; /* The blank space is required to avoid a GTK+/Pango bug */
3437 #endif
3433 3438
3434 if (message) { 3439 if (message) {
3435 GtkTextIter iter; 3440 GtkTextIter iter;
3436 gtk_text_buffer_get_end_iter(buffer, &iter); 3441 gtk_text_buffer_get_end_iter(buffer, &iter);
3437 gtk_text_buffer_create_mark(buffer, "typing-notification-start", &iter, TRUE); 3442 gtk_text_buffer_create_mark(buffer, "typing-notification-start", &iter, TRUE);
3456 3461
3457 if (im == NULL) 3462 if (im == NULL)
3458 return; 3463 return;
3459 3464
3460 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) { 3465 if (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING) {
3461 update_typing_message(gtkconv, "\n"); 3466 #ifdef RESERVE_LINE
3467 update_typing_message(gtkconv, NULL);
3468 #else
3469 update_typing_message(gtkconv, "\n ");
3470 #endif
3462 return; 3471 return;
3463 } 3472 }
3464 3473
3465 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) { 3474 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) {
3466 message = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_title(conv)); 3475 message = g_strdup_printf(_("\n%s is typing..."), purple_conversation_get_title(conv));