diff --git a/src/widgets/gm-world-input-view.c b/src/widgets/gm-world-input-view.c index 6a2c274..feea10a 100644 --- a/src/widgets/gm-world-input-view.c +++ b/src/widgets/gm-world-input-view.c @@ -5,9 +5,9 @@ #include "gm-world-input-view.h" #include "gm-world-view.h" -#include "gm-world.h" -#include "gm-color-table.h" -#include "debug.h" +#include "../gm-world.h" +#include "../gm-color-table.h" +#include "../debug.h" #define GM_WORLD_INPUT_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GM_TYPE_WORLD_INPUT_VIEW, GmWorldInputViewPrivate)) @@ -114,7 +114,7 @@ gm_world_input_view_set_text(GmWorldInputView *view, gchar *text, gint len) { void gm_world_input_view_update_colors(GmWorldInputView *view) { - GdkColor col; + /*GdkColor col; if (view->priv->color_table != NULL) { if (gm_color_table_get(view->priv->color_table, "bg_default", &col)) { @@ -125,7 +125,7 @@ gm_world_input_view_update_colors(GmWorldInputView *view) { gtk_widget_modify_text(GTK_WIDGET(view), GTK_STATE_NORMAL, &col); } - } + }*/ } void @@ -254,8 +254,10 @@ on_gm_world_input_view_key_pressed(GtkWidget *widget, GdkEventKey *event, gchar *text; gboolean result = TRUE, isUp; GtkTextBuffer *buf; - GtkTextIter start, end; + GtkTextIter start, end, cursor; + GtkTextMark *insert; GList *item, *found = NULL; + gint line; buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view)); @@ -269,6 +271,16 @@ on_gm_world_input_view_key_pressed(GtkWidget *widget, GdkEventKey *event, if (!view->priv->history) { break; } + + insert = gtk_text_buffer_get_insert(buf); + gtk_text_buffer_get_iter_at_mark(buf, &cursor, insert); + line = gtk_text_iter_get_line(&cursor); + + if ((isUp && line != 0) || (!isUp && line != + gtk_text_buffer_get_line_count(buf) - 1)) { + g_free(text); + return FALSE; + } // If the current position is empty then append a new history item if (!view->priv->position) { @@ -286,7 +298,6 @@ on_gm_world_input_view_key_pressed(GtkWidget *widget, GdkEventKey *event, // If the current prefix is NULL then we set the new prefix to // the current text if (view->priv->prefix == NULL) { - debug_msg(0, "Prefix: %s", text); view->priv->prefix = g_strdup(text); } @@ -337,8 +348,6 @@ on_gm_world_input_view_key_pressed(GtkWidget *widget, GdkEventKey *event, g_signal_emit(view, world_input_view_signals[TEXT_ACTIVATE], 0, text); - - debug_msg(0, "%d", view->priv->history); if (view->priv->history) { item = g_list_last(*view->priv->history);