diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2004-07-10 23:14:42 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2004-07-10 23:14:42 +0000 |
commit | d204ab72c3526572408d5447787349c31fa73ffe (patch) | |
tree | 0f8070dc7f1f0c5acb4a89c861bd295d7d5d6133 | |
parent | 9abb74ea39d78ba6148be6118e897298e051c95f (diff) | |
download | mdk-d204ab72c3526572408d5447787349c31fa73ffe.tar.gz mdk-d204ab72c3526572408d5447787349c31fa73ffe.tar.bz2 |
(complete_command_) (on_command_prompt_key_press_event): fixed cursor
position after completion.
-rw-r--r-- | mixgtk/mixgtk_cmd_dispatcher.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mixgtk/mixgtk_cmd_dispatcher.c b/mixgtk/mixgtk_cmd_dispatcher.c index 1ea7df7..6b7517a 100644 --- a/mixgtk/mixgtk_cmd_dispatcher.c +++ b/mixgtk/mixgtk_cmd_dispatcher.c @@ -1,7 +1,7 @@ /* -*-c-*- -------------- mixgtk_cmd_dispatcher.c : * Implementation of the functions declared in mixgtk_cmd_dispatcher.h * ------------------------------------------------------------------ - * $Id: mixgtk_cmd_dispatcher.c,v 1.19 2004/07/04 22:34:15 jao Exp $ + * $Id: mixgtk_cmd_dispatcher.c,v 1.20 2004/07/10 23:14:42 jao Exp $ * ------------------------------------------------------------------ * Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc. * @@ -474,7 +474,10 @@ complete_command_ (void) gtk_text_buffer_insert_at_cursor (buf, "\n", -1); } else - gtk_text_buffer_insert_at_cursor (buf, " ", -1); + { + gint pos = strlen (prefix); + gtk_editable_insert_text (GTK_EDITABLE (entry), " ", 1, &pos); + } flush_log_ (&dis_data_); } } @@ -483,6 +486,7 @@ int on_command_prompt_key_press_event (GtkEntry *w, GdkEventKey *e, gpointer d) { guint key = e->keyval; + gboolean result = FALSE; #ifdef HAVE_LIBHISTORY HIST_ENTRY *entry = NULL; @@ -491,24 +495,26 @@ on_command_prompt_key_press_event (GtkEntry *w, GdkEventKey *e, gpointer d) entry = previous_history (); if (entry && entry->line) gtk_entry_set_text (w, entry->line); - return TRUE; + result = TRUE; } if (key == GDK_Down) { entry = next_history (); if (entry && entry->line) gtk_entry_set_text (w, entry->line); - return TRUE; + result = TRUE; } #endif if (key == GDK_Tab) { complete_command_ (); - return TRUE; + result = TRUE; } - return FALSE; + if (result) gtk_editable_set_position (GTK_EDITABLE (w), -1); + + return result; } void |