# HG changeset patch # User Sadrul Habib Chowdhury # Date 1156057869 0 # Node ID e9dd2f76e61bcfc8f1f04d9ff317f696707e7622 # Parent e9304dd009922d1700c29de7a94e521f962d1770 [gaim-migrate @ 16897] A couple more keybindings. committer: Tailor Script diff -r e9304dd00992 -r e9dd2f76e61b console/libgnt/gntentry.c --- a/console/libgnt/gntentry.c Sun Aug 20 02:24:15 2006 +0000 +++ b/console/libgnt/gntentry.c Sun Aug 20 07:11:09 2006 +0000 @@ -255,6 +255,16 @@ move_forward(entry); return TRUE; } + else if (strcmp(text + 1, GNT_KEY_HOME) == 0) + { + move_start(entry); + return TRUE; + } + else if (strcmp(text + 1, GNT_KEY_END) == 0) + { + move_end(entry); + return TRUE; + } else if (strcmp(text + 1, GNT_KEY_CTRL_DOWN) == 0 && entry->histlength) { if (entry->history->prev) @@ -371,7 +381,14 @@ entry->end += len; while (str < next) - *(entry->cursor++) = *str++; + { + if (*str == '\r' || *str == '\n') + *entry->cursor = ' '; + else + *entry->cursor = *str; + entry->cursor++; + str++; + } while (g_utf8_pointer_to_offset(entry->scroll, entry->cursor) >= widget->priv.width) entry->scroll = g_utf8_find_next_char(entry->scroll, NULL); diff -r e9304dd00992 -r e9dd2f76e61b console/libgnt/gntkeys.h --- a/console/libgnt/gntkeys.h Sun Aug 20 02:24:15 2006 +0000 +++ b/console/libgnt/gntkeys.h Sun Aug 20 07:11:09 2006 +0000 @@ -16,6 +16,8 @@ #define GNT_KEY_PGUP "[5~" #define GNT_KEY_PGDOWN "[6~" +#define GNT_KEY_HOME "[7~" +#define GNT_KEY_END "[8~" #define GNT_KEY_ENTER "\r" diff -r e9304dd00992 -r e9dd2f76e61b console/libgnt/gntmain.c --- a/console/libgnt/gntmain.c Sun Aug 20 02:24:15 2006 +0000 +++ b/console/libgnt/gntmain.c Sun Aug 20 07:11:09 2006 +0000 @@ -681,7 +681,9 @@ locale = setlocale(LC_ALL, ""); - g_io_channel_unref(channel); +#if 0 + g_io_channel_unref(channel); /* Apparently this causes crash for some people */ +#endif if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) ascii_only = FALSE; diff -r e9304dd00992 -r e9dd2f76e61b console/libgnt/gnttree.c --- a/console/libgnt/gnttree.c Sun Aug 20 02:24:15 2006 +0000 +++ b/console/libgnt/gnttree.c Sun Aug 20 07:11:09 2006 +0000 @@ -490,6 +490,41 @@ else redraw_tree(tree); } + else if (strcmp(text+1, GNT_KEY_PGDOWN) == 0) + { + row = get_next(tree->bottom); + if (row) + { + int dist = get_distance(tree->top, tree->current); + tree->top = tree->bottom; + tree->current = get_next_n_opt(tree->top, dist, NULL); + redraw_tree(tree); + } + else if (tree->current != tree->bottom) + { + tree->current = tree->bottom; + redraw_tree(tree); + } + } + else if (strcmp(text+1, GNT_KEY_PGUP) == 0) + { + if (tree->top != tree->root) + { + int dist = get_distance(tree->top, tree->current); + row = get_prev_n(tree->top, widget->priv.height - 1 - + tree->show_title * 2 - 2 * (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER) == 0)); + if (row == NULL) + row = tree->root; + tree->top = row; + tree->current = get_next_n_opt(tree->top, dist, NULL); + redraw_tree(tree); + } + else if (tree->current != tree->top) + { + tree->current = tree->top; + redraw_tree(tree); + } + } } else if (iscntrl(text[0])) {