From b12ca738583ee21b1533377b3424baba188ba2e0 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 8 May 2011 13:53:09 +0200 Subject: [PATCH] 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. --- xoptions.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) 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; } -- 1.7.0.4