From b37a8fe1087578a3236090958f2e503ad0bd2907 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 21 Feb 2010 18:25:45 +0100 Subject: [PATCH] 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. --- backend.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) 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; -- 1.7.0.4