editor gadget now uses gadget-selection protocol
parent
1e419e6580
commit
0b8c907ec5
|
@ -14,8 +14,8 @@ sequences ;
|
||||||
dup editor-caret click-loc ;
|
dup editor-caret click-loc ;
|
||||||
|
|
||||||
: editor-copy ( editor clipboard -- )
|
: editor-copy ( editor clipboard -- )
|
||||||
over editor-selection? [
|
over gadget-selection? [
|
||||||
>r [ editor-selection ] keep r> copy-clipboard
|
>r [ gadget-selection ] keep r> copy-clipboard
|
||||||
] [
|
] [
|
||||||
2drop
|
2drop
|
||||||
] if ;
|
] if ;
|
||||||
|
@ -24,7 +24,7 @@ sequences ;
|
||||||
dupd editor-copy remove-editor-selection ;
|
dupd editor-copy remove-editor-selection ;
|
||||||
|
|
||||||
: delete/backspace ( elt editor quot -- | quot: caret editor -- from to )
|
: delete/backspace ( elt editor quot -- | quot: caret editor -- from to )
|
||||||
over editor-selection? [
|
over gadget-selection? [
|
||||||
drop nip remove-editor-selection
|
drop nip remove-editor-selection
|
||||||
] [
|
] [
|
||||||
over >r >r dup editor-caret* swap control-model
|
over >r >r dup editor-caret* swap control-model
|
||||||
|
|
|
@ -186,10 +186,10 @@ M: editor draw-gadget* ( gadget -- )
|
||||||
M: editor pref-dim* ( editor -- dim )
|
M: editor pref-dim* ( editor -- dim )
|
||||||
dup editor-width swap editor-height 2array ;
|
dup editor-width swap editor-height 2array ;
|
||||||
|
|
||||||
: editor-selection? ( editor -- ? )
|
M: editor gadget-selection? ( editor -- ? )
|
||||||
selection-start/end = not ;
|
selection-start/end = not ;
|
||||||
|
|
||||||
: editor-selection ( editor -- str )
|
M: editor gadget-selection ( editor -- str )
|
||||||
[ selection-start/end ] keep control-model doc-range ;
|
[ selection-start/end ] keep control-model doc-range ;
|
||||||
|
|
||||||
: remove-editor-selection ( editor -- )
|
: remove-editor-selection ( editor -- )
|
||||||
|
|
Loading…
Reference in New Issue