2 USING: documents documents.private accessors sequences
3 namespaces tools.test make arrays kernel fry ;
10 { 1 10 } [ , "HI" , ] each-line
17 { 1 11 } [ , "HI" , ] each-line
21 [ { 1 "HI" 2 "HI" } ] [
24 { 2 11 } [ , "HI" , ] each-line
28 [ { { t f 1 } { t f 2 } } ] [
32 '[ [ _ _ ] dip 3array , ] each-line
36 [ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
37 [ { 10 4 } ] [ { "a" } { 10 3 } text+loc ] unit-test
41 "Hello world,\nhow are you?\nMore text"
42 "doc" get set-doc-string
43 { 10 0 } "doc" get validate-loc
48 "Hello world,\nhow are you?\nMore text"
49 "doc" get set-doc-string
50 { 1 20 } "doc" get validate-loc
53 [ " world,\nhow are you?\nMore" ] [
55 "Hello world,\nhow are you?\nMore text"
56 "doc" get set-doc-string
57 { 0 5 } { 2 4 } "doc" get doc-range
60 [ "Hello world,\nhow you?\nMore text" ] [
62 "Hello world,\nhow are you?\nMore text"
63 "doc" get set-doc-string
64 { 1 3 } { 1 7 } "doc" get remove-doc-range
68 [ "Hello world,\nhow text" ] [
70 "Hello world,\nhow are you?\nMore text"
71 "doc" get set-doc-string
72 { 1 3 } { 2 4 } "doc" get remove-doc-range
76 [ "Hello world,\nhow you?\nMore text" ] [
78 "Hello world,\nhow are you?\nMore text"
79 "doc" get set-doc-string
80 "" { 1 3 } { 1 7 } "doc" get set-doc-range
84 [ "Hello world,\nhow text" ] [
86 "Hello world,\nhow are you?\nMore text"
87 "doc" get set-doc-string
88 "" { 1 3 } { 2 4 } "doc" get set-doc-range
93 [ ] [ <document> "d" set ] unit-test
95 [ ] [ "Hello, world." "d" get set-doc-string ] unit-test
100 { new-string "Hello, world." }
105 ] [ "d" get undos>> first ] unit-test
107 [ ] [ "Goodbye" { 0 0 } { 0 5 } "d" get set-doc-range ] unit-test
109 [ "Goodbye, world." ] [ "d" get doc-string ] unit-test
111 [ ] [ "cruel " { 0 9 } { 0 9 } "d" get set-doc-range ] unit-test
113 [ 3 ] [ "d" get undos>> length ] unit-test
115 [ "Goodbye, cruel world." ] [ "d" get doc-string ] unit-test
117 [ "" { 0 9 } { 0 15 } ] [
119 [ old-string>> ] [ from>> ] [ new-to>> ] tri
122 [ ] [ "d" get undo ] unit-test
124 [ "Goodbye, world." ] [ "d" get doc-string ] unit-test
126 [ ] [ "d" get undo ] unit-test
128 [ "Hello, world." ] [ "d" get doc-string ] unit-test
130 [ ] [ "d" get redo ] unit-test
132 [ "Goodbye, world." ] [ "d" get doc-string ] unit-test
134 [ ] [ <document> "d" set ] unit-test
136 [ ] [ "d" get clear-doc ] unit-test
138 [ ] [ "d" get clear-doc ] unit-test
140 [ 0 ] [ "d" get undos>> length ] unit-test