Another clean up
parent
5f2fd87ce1
commit
cc8e049c02
|
@ -9,11 +9,17 @@ TUPLE: history document elements index ;
|
||||||
: <history> ( document -- history )
|
: <history> ( document -- history )
|
||||||
V{ } clone 0 history boa ;
|
V{ } clone 0 history boa ;
|
||||||
|
|
||||||
|
: history-add ( history -- input )
|
||||||
|
dup elements>> length 1+ >>index
|
||||||
|
[ document>> doc-string [ <input> ] [ empty? ] bi ] keep
|
||||||
|
'[ [ _ elements>> push ] keep ] unless ;
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
|
||||||
: save-history ( history -- input )
|
: save-history ( history -- )
|
||||||
[ document>> doc-string [ <input> ] [ empty? ] bi ] keep
|
[ document>> doc-string ] keep
|
||||||
'[ [ _ [ index>> ] [ elements>> ] bi set-nth ] keep ] unless ;
|
'[ <input> _ [ index>> ] [ elements>> ] bi set-nth ]
|
||||||
|
unless-empty ;
|
||||||
|
|
||||||
: update-document ( history -- )
|
: update-document ( history -- )
|
||||||
[ [ index>> ] [ elements>> ] bi nth string>> ]
|
[ [ index>> ] [ elements>> ] bi nth string>> ]
|
||||||
|
@ -27,7 +33,7 @@ TUPLE: history document elements index ;
|
||||||
: history-recall ( history i -- )
|
: history-recall ( history i -- )
|
||||||
[ [ elements>> empty? ] keep ] dip '[
|
[ [ elements>> empty? ] keep ] dip '[
|
||||||
_
|
_
|
||||||
[ save-history drop ]
|
[ save-history ]
|
||||||
[ _ change-history-index ]
|
[ _ change-history-index ]
|
||||||
[ update-document ]
|
[ update-document ]
|
||||||
tri
|
tri
|
||||||
|
@ -35,10 +41,6 @@ TUPLE: history document elements index ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: history-add ( history -- input )
|
|
||||||
dup elements>> length 1+ >>index
|
|
||||||
save-history ;
|
|
||||||
|
|
||||||
: history-recall-previous ( history -- )
|
: history-recall-previous ( history -- )
|
||||||
-1 history-recall ;
|
-1 history-recall ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue