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 | a1f5c3dfa9c3aa15c238d8e80194a378a6292d8a (patch) | |
tree | a350ac39af5cab4d55612980a8a92a10b262d870 /mixgtk | |
parent | a544dd041f2e000e3ba28faf75a50156a8b522a1 (diff) | |
download | mdk-a1f5c3dfa9c3aa15c238d8e80194a378a6292d8a.tar.gz mdk-a1f5c3dfa9c3aa15c238d8e80194a378a6292d8a.tar.bz2 |
(complete_command_) (on_command_prompt_key_press_event): fixed cursor
position after completion.
Diffstat (limited to 'mixgtk')
-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 |