# HG changeset patch # User Sean Egan # Date 1017802922 0 # Node ID 4d967ccd797bf1d9db3c0a959cb9bbc34658dd9b # Parent 025a8042dd733313e1960d729ee20eb6ee93fd11 [gaim-migrate @ 3137] Send History committer: Tailor Script diff -r 025a8042dd73 -r 4d967ccd797b ChangeLog --- a/ChangeLog Tue Apr 02 01:04:35 2002 +0000 +++ b/ChangeLog Wed Apr 03 03:02:02 2002 +0000 @@ -2,7 +2,7 @@ version 0.56: * German translation update (Thanks Karsten Weiss) - + * Shell-like send history binded to Ctrl-Up and Ctrl-Down version 0.55 (03/29/2002): * Jabber improvements (Thanks Jim Seymour) * Various sound cleanups (Thanks Robert McQueen) diff -r 025a8042dd73 -r 4d967ccd797b src/conversation.c --- a/src/conversation.c Tue Apr 02 01:04:35 2002 +0000 +++ b/src/conversation.c Wed Apr 03 03:02:02 2002 +0000 @@ -183,6 +183,7 @@ if (connections) c->gc = (struct gaim_connection *)connections->data; c->history = g_string_new(""); + c->send_history = g_list_append(NULL, NULL); conversations = g_list_append(conversations, c); show_conv(c); update_icon(c); @@ -270,6 +271,13 @@ if (c->save_icon) gtk_widget_destroy(c->save_icon); #endif + c->send_history = g_list_first(c->send_history); + while (c->send_history) { + if (c->send_history->data) + g_free(c->send_history->data); + c->send_history = c->send_history->next; + } + g_list_free(c->send_history); if (c->typing_timeout) gtk_timeout_remove(c->typing_timeout); g_string_free(c->history, TRUE); @@ -841,6 +849,44 @@ if (oldpos == pos) gtk_editable_set_position(GTK_EDITABLE(entry), pos + 1); } else if (event->state & GDK_CONTROL_MASK) { + int pos = 0; + switch (event->keyval) { + case GDK_Up: + debug_printf("YOU HIT UP!\n"); + if (!c->send_history) + break; + debug_printf("history exists\n"); + if (!c->send_history->prev) { + debug_printf("at curent\n"); + if (c->send_history->data) + g_free(c->send_history->data); + c->send_history->data = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1); + } + if (c->send_history->next && c->send_history->next->data) { + debug_printf("going to ->next\n"); + c->send_history = c->send_history->next; + gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1); + gtk_editable_insert_text(GTK_EDITABLE(entry), + c->send_history->data, + strlen(c->send_history->data), + &pos); + } + + break; + case GDK_Down: + if (!c->send_history) + break; + if (c->send_history->prev) { + c->send_history = c->send_history->prev; + if (c->send_history->data) { + gtk_editable_delete_text (GTK_EDITABLE(entry),0,-1); + gtk_editable_insert_text (GTK_EDITABLE(entry), c->send_history->data, + strlen(c->send_history->data), &pos); + + } + } + break; + } if (convo_options & OPT_CONVO_CTL_CHARS) { switch (event->keyval) { case 'i': @@ -1003,6 +1049,7 @@ int limit; gulong length=0; int err = 0; + GList *first; if (!c->gc) return; @@ -1018,6 +1065,12 @@ return; } + first = g_list_first(c->send_history); + if (first->data) + g_free(first->data); + first->data = g_strdup(buf); + c->send_history = g_list_prepend(first, NULL); + buf2 = g_malloc(limit); if (c->gc->flags & OPT_CONN_HTML) { diff -r 025a8042dd73 -r 4d967ccd797b src/ui.h --- a/src/ui.h Tue Apr 02 01:04:35 2002 +0000 +++ b/src/ui.h Wed Apr 03 03:02:02 2002 +0000 @@ -138,6 +138,7 @@ GdkColor fgcol; int hasfg; + GList *send_history; GString *history; GtkWidget *send;