wrap.words: rename wrap.words:word to wrapping-word. this ``wrapping-word`` is loaded by default and now this trivial vocabulary won't cause a naming conflict with the builtin ``word`` and one of the most used symbols and concepts in the entire language.
parent
eca8b7e49c
commit
af90d77fc2
|
@ -28,7 +28,7 @@ TUPLE: paragraph < aligned-gadget margin wrapped ;
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: gadget>word ( gadget -- word )
|
: gadget>word ( gadget -- word )
|
||||||
[ ] [ pref-dim first ] [ word-break? ] tri <word> ;
|
[ ] [ pref-dim first ] [ word-break? ] tri <wrapping-word> ;
|
||||||
|
|
||||||
: line-width ( words -- n )
|
: line-width ( words -- n )
|
||||||
[ break?>> ] trim-tail-slice [ width>> ] map-sum ;
|
[ break?>> ] trim-tail-slice [ width>> ] map-sum ;
|
||||||
|
|
|
@ -6,75 +6,75 @@ IN: wrap.words.tests
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
T{ word f 1 10 f }
|
T{ wrapping-word f 1 10 f }
|
||||||
T{ word f 2 10 f }
|
T{ wrapping-word f 2 10 f }
|
||||||
T{ word f 3 2 t }
|
T{ wrapping-word f 3 2 t }
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
T{ word f 4 10 f }
|
T{ wrapping-word f 4 10 f }
|
||||||
T{ word f 5 10 f }
|
T{ wrapping-word f 5 10 f }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} [
|
} [
|
||||||
{
|
{
|
||||||
T{ word f 1 10 f }
|
T{ wrapping-word f 1 10 f }
|
||||||
T{ word f 2 10 f }
|
T{ wrapping-word f 2 10 f }
|
||||||
T{ word f 3 2 t }
|
T{ wrapping-word f 3 2 t }
|
||||||
T{ word f 4 10 f }
|
T{ wrapping-word f 4 10 f }
|
||||||
T{ word f 5 10 f }
|
T{ wrapping-word f 5 10 f }
|
||||||
} 35 35 wrap-words [ { } like ] map
|
} 35 35 wrap-words [ { } like ] map
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
T{ word f 1 10 f }
|
T{ wrapping-word f 1 10 f }
|
||||||
T{ word f 2 10 f }
|
T{ wrapping-word f 2 10 f }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
T{ word f 4 10 f }
|
T{ wrapping-word f 4 10 f }
|
||||||
T{ word f 5 10 f }
|
T{ wrapping-word f 5 10 f }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} [
|
} [
|
||||||
{
|
{
|
||||||
T{ word f 1 10 f }
|
T{ wrapping-word f 1 10 f }
|
||||||
T{ word f 2 10 f }
|
T{ wrapping-word f 2 10 f }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
T{ word f 4 10 f }
|
T{ wrapping-word f 4 10 f }
|
||||||
T{ word f 5 10 f }
|
T{ wrapping-word f 5 10 f }
|
||||||
} 35 35 wrap-words [ { } like ] map
|
} 35 35 wrap-words [ { } like ] map
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
T{ word f 1 10 t }
|
T{ wrapping-word f 1 10 t }
|
||||||
T{ word f 1 10 f }
|
T{ wrapping-word f 1 10 f }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
T{ word f 2 10 f }
|
T{ wrapping-word f 2 10 f }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
T{ word f 4 10 f }
|
T{ wrapping-word f 4 10 f }
|
||||||
T{ word f 5 10 f }
|
T{ wrapping-word f 5 10 f }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} [
|
} [
|
||||||
{
|
{
|
||||||
T{ word f 1 10 t }
|
T{ wrapping-word f 1 10 t }
|
||||||
T{ word f 1 10 f }
|
T{ wrapping-word f 1 10 f }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
T{ word f 2 10 f }
|
T{ wrapping-word f 2 10 f }
|
||||||
T{ word f 3 9 t }
|
T{ wrapping-word f 3 9 t }
|
||||||
T{ word f 4 10 f }
|
T{ wrapping-word f 4 10 f }
|
||||||
T{ word f 5 10 f }
|
T{ wrapping-word f 5 10 f }
|
||||||
} 35 35 wrap-words [ { } like ] map
|
} 35 35 wrap-words [ { } like ] map
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -4,8 +4,8 @@ USING: accessors grouping kernel math sequences
|
||||||
sequences.private splitting.monotonic wrap ;
|
sequences.private splitting.monotonic wrap ;
|
||||||
IN: wrap.words
|
IN: wrap.words
|
||||||
|
|
||||||
TUPLE: word key width break? ;
|
TUPLE: wrapping-word key width break? ;
|
||||||
C: <word> word
|
C: <wrapping-word> wrapping-word
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue