From d5e5991671cdd61b169be0fb829bfcc0f597be11 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 20 Mar 2013 15:30:29 -0700 Subject: [PATCH] prettyprint: fix length limit to be 'maximum length before truncation'. --- basis/prettyprint/backend/backend.factor | 2 +- basis/prettyprint/prettyprint-tests.factor | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/basis/prettyprint/backend/backend.factor b/basis/prettyprint/backend/backend.factor index fc3c66de9f..ec76a79d3c 100644 --- a/basis/prettyprint/backend/backend.factor +++ b/basis/prettyprint/backend/backend.factor @@ -196,7 +196,7 @@ M: tuple pprint* : do-length-limit ( seq -- trimmed n/f ) length-limit get dup [ - over length over [-] + 1 - over length over [-] dup 1 > [ [ head-slice ] dip ] [ 2drop f ] if ] when ; diff --git a/basis/prettyprint/prettyprint-tests.factor b/basis/prettyprint/prettyprint-tests.factor index 471fba7026..5efebc3aac 100644 --- a/basis/prettyprint/prettyprint-tests.factor +++ b/basis/prettyprint/prettyprint-tests.factor @@ -465,12 +465,7 @@ TUPLE: fo { a intersection{ integer fixnum } initial: 0 } ; with-string-writer ] unit-test -{ "{ 0 1 2 3 4 5 }" } [ +{ "{ 0 1 2 3 ~2 more~ }" } [ [ 5 length-limit [ 6 iota >array pprint ] with-variable ] with-string-writer ] unit-test - -{ "{ 0 1 2 3 4 ~2 more~ }" } [ - [ 5 length-limit [ 7 iota >array pprint ] with-variable ] - with-string-writer -] unit-test