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