From 7801dc7d61bc47273aa27cd65f60bc42e6f5a859 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 17 Mar 2013 10:33:31 +0100 Subject: [PATCH] Fix GTK SetInsertPos SetInsertPos() was not yet ported to GTK, with as a result that the cursor was positioned at the start of a line recalled in the ICS Input Box, rather than at the end. The code also called SetInsertPos to force scrolling to that point in the text (which in Xaw is an automatic side effect). So for multi-line text edits this function calls ScrollToCursor(). For some reason this does not work when replacing texts in the Chat Box memo, when switching chat, although it does work in the same memo when a line is added to the existing text. --- dialogs.c | 3 ++- gtk/xoptions.c | 9 ++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dialogs.c b/dialogs.c index 899bf71..caa98c4 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1167,7 +1167,8 @@ IcsKey (int n) case -1: val = NextInHistory(); } - SetWidgetText(&boxOptions[0], val ? val : "", InputBoxDlg); + SetWidgetText(&boxOptions[0], val = val ? val : "", InputBoxDlg); + SetInsertPos(&boxOptions[0], strlen(val)); } static void diff --git a/gtk/xoptions.c b/gtk/xoptions.c index 18fc857..0eb1658 100644 --- a/gtk/xoptions.c +++ b/gtk/xoptions.c @@ -1571,13 +1571,8 @@ SendText (int n) void SetInsertPos (Option *opt, int pos) { -#ifdef TODO_GTK - Arg args[16]; - XtSetArg(args[0], XtNinsertPosition, pos); - XtSetValues(opt->handle, args, 1); -// SetFocus(opt->handle, shells[InputBoxDlg], NULL, False); // No idea why this does not work, and the following is needed: -// XSetInputFocus(xDisplay, XtWindow(opt->handle), RevertToPointerRoot, CurrentTime); -#endif + if(opt->value > 80) ScrollToCursor(opt, pos); + else gtk_editable_set_position(GTK_EDITABLE(opt->handle), pos); } void -- 1.7.0.4