From: H.G. Muller Date: Sun, 17 Mar 2013 09:33:31 +0000 (+0100) Subject: Fix GTK SetInsertPos X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7801dc7d61bc47273aa27cd65f60bc42e6f5a859;p=xboard.git 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. --- 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