Fix one-word-elt
parent
fda9958ab4
commit
114ee74041
|
@ -195,11 +195,11 @@ TUPLE: one-word-elt ;
|
||||||
|
|
||||||
M: one-word-elt prev-elt
|
M: one-word-elt prev-elt
|
||||||
drop
|
drop
|
||||||
[ [ f -rot >r 1- r> (prev-word) ] (word-elt) ] (prev-char) ;
|
[ f -rot >r 1- r> (prev-word) ] (word-elt) ;
|
||||||
|
|
||||||
M: one-word-elt next-elt
|
M: one-word-elt next-elt
|
||||||
drop
|
drop
|
||||||
[ [ f -rot (next-word) ] (word-elt) ] (next-char) ;
|
[ f -rot (next-word) ] (word-elt) ;
|
||||||
|
|
||||||
TUPLE: word-elt ;
|
TUPLE: word-elt ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
USING: tools.deploy.config ;
|
||||||
|
H{
|
||||||
|
{ deploy-compiler? t }
|
||||||
|
{ deploy-word-props? f }
|
||||||
|
{ deploy-ui? t }
|
||||||
|
{ deploy-reflection 1 }
|
||||||
|
{ deploy-name "springies.models.2x2snake" }
|
||||||
|
{ deploy-c-types? f }
|
||||||
|
{ deploy-word-defs? f }
|
||||||
|
{ "stop-after-last-window?" t }
|
||||||
|
{ deploy-math? t }
|
||||||
|
{ deploy-io 1 }
|
||||||
|
}
|
|
@ -30,6 +30,16 @@ tools.test.inference tools.test.ui models ;
|
||||||
] with-grafted-gadget
|
] with-grafted-gadget
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
[ "bar" ] [
|
||||||
|
<editor> "editor" set
|
||||||
|
"editor" get [
|
||||||
|
"bar\nbaz quux" "editor" get set-editor-string
|
||||||
|
{ 0 3 } "editor" get editor-caret set-model
|
||||||
|
"editor" get select-word
|
||||||
|
"editor" get gadget-selection
|
||||||
|
] with-grafted-gadget
|
||||||
|
] unit-test
|
||||||
|
|
||||||
{ 0 1 } [ <editor> ] unit-test-effect
|
{ 0 1 } [ <editor> ] unit-test-effect
|
||||||
|
|
||||||
"hello" <model> <field> "field" set
|
"hello" <model> <field> "field" set
|
||||||
|
|
|
@ -320,11 +320,6 @@ M: editor gadget-text* editor-string % ;
|
||||||
|
|
||||||
: end-of-document ( editor -- ) T{ doc-elt } editor-next ;
|
: end-of-document ( editor -- ) T{ doc-elt } editor-next ;
|
||||||
|
|
||||||
: selected-word ( editor -- string )
|
|
||||||
dup gadget-selection? [
|
|
||||||
dup T{ one-word-elt } select-elt
|
|
||||||
] unless gadget-selection ;
|
|
||||||
|
|
||||||
: position-caret ( editor -- )
|
: position-caret ( editor -- )
|
||||||
mouse-elt dup T{ one-char-elt } =
|
mouse-elt dup T{ one-char-elt } =
|
||||||
[ drop dup extend-selection dup editor-mark click-loc ]
|
[ drop dup extend-selection dup editor-mark click-loc ]
|
||||||
|
@ -408,6 +403,11 @@ editor "caret-motion" f {
|
||||||
|
|
||||||
: select-word T{ one-word-elt } select-elt ;
|
: select-word T{ one-word-elt } select-elt ;
|
||||||
|
|
||||||
|
: selected-word ( editor -- string )
|
||||||
|
dup gadget-selection?
|
||||||
|
[ dup select-word ] unless
|
||||||
|
gadget-selection ;
|
||||||
|
|
||||||
: select-previous-character T{ char-elt } editor-select-prev ;
|
: select-previous-character T{ char-elt } editor-select-prev ;
|
||||||
|
|
||||||
: select-next-character T{ char-elt } editor-select-next ;
|
: select-next-character T{ char-elt } editor-select-next ;
|
||||||
|
|
Loading…
Reference in New Issue