From a1f5c3dfa9c3aa15c238d8e80194a378a6292d8a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 10 Jul 2004 23:14:42 +0000 Subject: (complete_command_) (on_command_prompt_key_press_event): fixed cursor position after completion. --- mixgtk/mixgtk_cmd_dispatcher.c | 18 ++++++++++++------ 1 file 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 -- cgit v1.2.3