From e1c9a1c270df4b13175131a12fd1940fb22edd90 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 21 Feb 2010 17:45:37 +0100 Subject: [PATCH] Insert autoKibitz continuation lines at end of line In the engine-output window lines that start with the ICS continuation sequence "\ " are inserted behind the line they belong to, in stead of at the top. This required keeping thrack of the length of the currently active line in OutputKibitz(). --- engineoutput.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engineoutput.c b/engineoutput.c index 9c493ad..6266f7c 100644 --- a/engineoutput.c +++ b/engineoutput.c @@ -483,10 +483,12 @@ static void UpdateControls( EngineOutputData * ed ) // [HGM] kibitz: write kibitz line; split window for it if necessary void OutputKibitz(int window, char *text) { + static int currentLineEnd[2]; + int where = 0; if(!EngineOutputIsUp()) return; if(!opponentKibitzes) { // on first kibitz of game, clear memos - DoClearMemo(1); - if(gameMode == IcsObserving) DoClearMemo(0); + DoClearMemo(1); currentLineEnd[1] = 0; + if(gameMode == IcsObserving) { DoClearMemo(0); currentLineEnd[0] = 0; } } opponentKibitzes = TRUE; // this causes split window DisplayMode in ICS modes. VerifyDisplayMode(); @@ -498,5 +500,8 @@ void OutputKibitz(int window, char *text) DoSetWindowText(1, nLabel, gameMode == IcsPlayingBlack ? gameInfo.white : gameInfo.black); // opponent name SetIcon( 1, nColorIcon, gameMode == IcsPlayingBlack ? nColorWhite : nColorBlack); SetIcon( 1, nStateIcon, nClear); - InsertIntoMemo(window-1, text, 0); // [HGM] multivar: always at top + if(strstr(text, "\\ ") == text) where = currentLineEnd[window-1]; // continuation line +//if(appData.debugMode) fprintf(debugFP, "insert '%s' at %d (end = %d,%d)\n", text, where, currentLineEnd[0], currentLineEnd[1]); + InsertIntoMemo(window-1, text, where); // [HGM] multivar: always at top + currentLineEnd[window-1] = where + strlen(text); } -- 1.7.0.4