From: Steinar H. Gunderson Date: Tue, 11 Nov 2014 19:36:47 +0000 (+0100) Subject: Only truncate history if needed. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=2e6f47cc12a8ce6fdd3c8d5da5183abb8cc3719a;hp=c17cb0c030ad2b4eb8493fbbc6aba34b68afacb6 Only truncate history if needed. --- diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index e7a0453..595bce1 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -407,16 +407,13 @@ var add_pv = function(fen, uci_pv, pretty_pv, move_num, toplay, opt_limit, opt_s var print_pv = function(line_num, pretty_pv, move_num, toplay, opt_limit, opt_showlast) { var pv = ''; var i = 0; - if (opt_limit && opt_showlast) { + if (opt_limit && opt_showlast && pretty_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 // opt_showlast is set, then it is the history, and thus, // the UI should be to expand the history. pv = '(…) '; i = pretty_pv.length - opt_limit; - if (i < 0) { - i = 0; - } if (i % 2 == 1) { ++i; }