From: H.G. Muller Date: Sun, 8 May 2011 11:53:09 +0000 (+0200) Subject: Fix vscrolling in XBoard Engine-Output window X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=b12ca738583ee21b1533377b3424baba188ba2e0;p=xboard.git Fix vscrolling in XBoard Engine-Output window After clicking the memos they scrolled to the bottom, because SetFocus put the insertion point at the very end of the text. This behavior is now reserved for text-edits containing less than 100 characters. --- diff --git a/xoptions.c b/xoptions.c index 055d804..e66e4bc 100644 --- a/xoptions.c +++ b/xoptions.c @@ -88,6 +88,7 @@ void SetFocus(Widget w, XtPointer data, XEvent *event, Boolean *b) { Arg args[2]; char *s; + int j; if(previous) { XtSetArg(args[0], XtNdisplayCaret, False); @@ -95,9 +96,10 @@ void SetFocus(Widget w, XtPointer data, XEvent *event, Boolean *b) } XtSetArg(args[0], XtNstring, &s); XtGetValues(w, args, 1); + j = 1; XtSetArg(args[0], XtNdisplayCaret, True); - XtSetArg(args[1], XtNinsertPosition, strlen(s)); - XtSetValues(w, args, 2); + if(!strchr(s, '\n')) XtSetArg(args[1], XtNinsertPosition, strlen(s)), j++; + XtSetValues(w, args, j); XtSetKeyboardFocus((Widget) data, w); previous = w; }