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
|
||||
|
||||
: gadget>word ( gadget -- word )
|
||||
[ ] [ pref-dim first ] [ word-break? ] tri <word> ;
|
||||
[ ] [ pref-dim first ] [ word-break? ] tri <wrapping-word> ;
|
||||
|
||||
: line-width ( words -- n )
|
||||
[ break?>> ] trim-tail-slice [ width>> ] map-sum ;
|
||||
|
|
|
@ -6,75 +6,75 @@ IN: wrap.words.tests
|
|||
{
|
||||
{
|
||||
{
|
||||
T{ word f 1 10 f }
|
||||
T{ word f 2 10 f }
|
||||
T{ word f 3 2 t }
|
||||
T{ wrapping-word f 1 10 f }
|
||||
T{ wrapping-word f 2 10 f }
|
||||
T{ wrapping-word f 3 2 t }
|
||||
}
|
||||
{
|
||||
T{ word f 4 10 f }
|
||||
T{ word f 5 10 f }
|
||||
T{ wrapping-word f 4 10 f }
|
||||
T{ wrapping-word f 5 10 f }
|
||||
}
|
||||
}
|
||||
} [
|
||||
{
|
||||
T{ word f 1 10 f }
|
||||
T{ word f 2 10 f }
|
||||
T{ word f 3 2 t }
|
||||
T{ word f 4 10 f }
|
||||
T{ word f 5 10 f }
|
||||
T{ wrapping-word f 1 10 f }
|
||||
T{ wrapping-word f 2 10 f }
|
||||
T{ wrapping-word f 3 2 t }
|
||||
T{ wrapping-word f 4 10 f }
|
||||
T{ wrapping-word f 5 10 f }
|
||||
} 35 35 wrap-words [ { } like ] map
|
||||
] unit-test
|
||||
|
||||
{
|
||||
{
|
||||
{
|
||||
T{ word f 1 10 f }
|
||||
T{ word f 2 10 f }
|
||||
T{ word f 3 9 t }
|
||||
T{ word f 3 9 t }
|
||||
T{ word f 3 9 t }
|
||||
T{ wrapping-word f 1 10 f }
|
||||
T{ wrapping-word f 2 10 f }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
}
|
||||
{
|
||||
T{ word f 4 10 f }
|
||||
T{ word f 5 10 f }
|
||||
T{ wrapping-word f 4 10 f }
|
||||
T{ wrapping-word f 5 10 f }
|
||||
}
|
||||
}
|
||||
} [
|
||||
{
|
||||
T{ word f 1 10 f }
|
||||
T{ word f 2 10 f }
|
||||
T{ word f 3 9 t }
|
||||
T{ word f 3 9 t }
|
||||
T{ word f 3 9 t }
|
||||
T{ word f 4 10 f }
|
||||
T{ word f 5 10 f }
|
||||
T{ wrapping-word f 1 10 f }
|
||||
T{ wrapping-word f 2 10 f }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
T{ wrapping-word f 4 10 f }
|
||||
T{ wrapping-word f 5 10 f }
|
||||
} 35 35 wrap-words [ { } like ] map
|
||||
] unit-test
|
||||
|
||||
{
|
||||
{
|
||||
{
|
||||
T{ word f 1 10 t }
|
||||
T{ word f 1 10 f }
|
||||
T{ word f 3 9 t }
|
||||
T{ wrapping-word f 1 10 t }
|
||||
T{ wrapping-word f 1 10 f }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
}
|
||||
{
|
||||
T{ word f 2 10 f }
|
||||
T{ word f 3 9 t }
|
||||
T{ wrapping-word f 2 10 f }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
}
|
||||
{
|
||||
T{ word f 4 10 f }
|
||||
T{ word f 5 10 f }
|
||||
T{ wrapping-word f 4 10 f }
|
||||
T{ wrapping-word f 5 10 f }
|
||||
}
|
||||
}
|
||||
} [
|
||||
{
|
||||
T{ word f 1 10 t }
|
||||
T{ word f 1 10 f }
|
||||
T{ word f 3 9 t }
|
||||
T{ word f 2 10 f }
|
||||
T{ word f 3 9 t }
|
||||
T{ word f 4 10 f }
|
||||
T{ word f 5 10 f }
|
||||
T{ wrapping-word f 1 10 t }
|
||||
T{ wrapping-word f 1 10 f }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
T{ wrapping-word f 2 10 f }
|
||||
T{ wrapping-word f 3 9 t }
|
||||
T{ wrapping-word f 4 10 f }
|
||||
T{ wrapping-word f 5 10 f }
|
||||
} 35 35 wrap-words [ { } like ] map
|
||||
] unit-test
|
||||
|
|
|
@ -4,8 +4,8 @@ USING: accessors grouping kernel math sequences
|
|||
sequences.private splitting.monotonic wrap ;
|
||||
IN: wrap.words
|
||||
|
||||
TUPLE: word key width break? ;
|
||||
C: <word> word
|
||||
TUPLE: wrapping-word key width break? ;
|
||||
C: <wrapping-word> wrapping-word
|
||||
|
||||
<PRIVATE
|
||||
|
||||
|
|
Loading…
Reference in New Issue