]> git.sesse.net Git - remoteglot/commitdiff
Fix regression in truncating PV.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 29 Dec 2022 10:15:45 +0000 (11:15 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 29 Dec 2022 10:15:45 +0000 (11:15 +0100)
www/js/remoteglot.js

index 5314a5681dbbbfbf7c589cd253b1179388988777..c2bf8ff482b7f69cb07bc09c4b1accd0659850e9 100644 (file)
@@ -734,6 +734,7 @@ function print_pv(line_num, splicepos, opt_limit, opt_showlast) {
 
        let ret = document.createDocumentFragment();
        let in_tb = false;
+       let i = 0;
        if (opt_limit && opt_showlast && pv.length > opt_limit) {
                // Truncate the PV at the beginning (instead of at the end).
                // We assume here that toplay is 'W'. We also assume that if
@@ -754,7 +755,7 @@ function print_pv(line_num, splicepos, opt_limit, opt_showlast) {
        } else if (toplay == 'B' && pv.length > 0) {
                ret.appendChild(document.createTextNode(move_num + '. … '));
        }
-       for (let i = 0; i < pv.length; ++i) {
+       for (; i < pv.length; ++i) {
                let link = document.createElement('a');
                link.className = 'move';
                link.setAttribute('id', 'automove' + line_num + '-' + i);