From: H.G. Muller Date: Sun, 21 Feb 2010 17:25:45 +0000 (+0100) Subject: Allow walking a kibitzed PV X-Git-Tag: master-20100221~4 X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=b37a8fe1087578a3236090958f2e503ad0bd2907 Allow walking a kibitzed PV If no tabs are found in te 'thinking output' we assume it is a captured kibitz message, and look for "PV=" to locate the start of a PV in it. Also try to include any continuation lines below the selected line. --- diff --git a/backend.c b/backend.c index 00b2d0e..f806abe 100644 --- a/backend.c +++ b/backend.c @@ -4888,14 +4888,17 @@ Boolean LoadMultiPV(int x, int y, char *buf, int index, int *start, int *end) { int startPV; + char *p; if(index < 0 || index >= strlen(buf)) return FALSE; // sanity lastX = x; lastY = y; while(index > 0 && buf[index-1] != '\n') index--; // beginning of line startPV = index; - while(buf[index] != '\n') if(buf[index++] == '\t') startPV = index; - index = startPV; - while(buf[index] && buf[index] != '\n') index++; + while(buf[index] != '\n') if(buf[index++] == '\t') startPV = index; + if(index == startPV && (p = StrCaseStr(buf+index, "PV="))) startPV = p - buf + 3; + index = startPV; + do{ while(buf[index] && buf[index] != '\n') index++; + } while(buf[index] == '\n' && buf[index+1] == '\\' && buf[index+2] == ' ' && index++); // join kibitzed PV continuation line buf[index] = 0; ParsePV(buf+startPV, FALSE); *start = startPV; *end = index-1;