Clicking in the pane focuses the input area
parent
81d23c3ac0
commit
7ec4f574a5
|
@ -29,11 +29,14 @@ selection-color caret mark selecting? ;
|
||||||
: init-current ( pane -- pane )
|
: init-current ( pane -- pane )
|
||||||
dup prototype>> clone >>current ; inline
|
dup prototype>> clone >>current ; inline
|
||||||
|
|
||||||
|
: focus-input ( pane -- )
|
||||||
|
input>> [ request-focus ] when* ;
|
||||||
|
|
||||||
: next-line ( pane -- )
|
: next-line ( pane -- )
|
||||||
clear-selection
|
clear-selection
|
||||||
[ input>> unparent ]
|
[ input>> unparent ]
|
||||||
[ init-current prepare-last-line ]
|
[ init-current prepare-last-line ]
|
||||||
[ input>> [ request-focus ] when* ] tri ;
|
[ focus-input ] tri ;
|
||||||
|
|
||||||
: pane-caret&mark ( pane -- caret mark )
|
: pane-caret&mark ( pane -- caret mark )
|
||||||
[ caret>> ] [ mark>> ] bi ; inline
|
[ caret>> ] [ mark>> ] bi ; inline
|
||||||
|
@ -364,9 +367,8 @@ M: paragraph stream-format
|
||||||
interleave
|
interleave
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: caret>mark ( pane -- pane )
|
: caret>mark ( pane -- )
|
||||||
dup caret>> >>mark
|
dup caret>> >>mark relayout-1 ;
|
||||||
dup relayout-1 ;
|
|
||||||
|
|
||||||
GENERIC: sloppy-pick-up* ( loc gadget -- n )
|
GENERIC: sloppy-pick-up* ( loc gadget -- n )
|
||||||
|
|
||||||
|
@ -388,45 +390,46 @@ M: f sloppy-pick-up*
|
||||||
[ 3drop { } ]
|
[ 3drop { } ]
|
||||||
if ;
|
if ;
|
||||||
|
|
||||||
: move-caret ( pane loc -- pane )
|
: move-caret ( pane loc -- )
|
||||||
over screen-loc v- over sloppy-pick-up >>caret
|
over screen-loc v- over sloppy-pick-up >>caret
|
||||||
dup relayout-1 ;
|
relayout-1 ;
|
||||||
|
|
||||||
: begin-selection ( pane -- )
|
: begin-selection ( pane -- )
|
||||||
f >>selecting?
|
f >>selecting?
|
||||||
hand-loc get move-caret
|
dup hand-loc get move-caret
|
||||||
f >>mark
|
f >>mark
|
||||||
drop ;
|
drop ;
|
||||||
|
|
||||||
: extend-selection ( pane -- )
|
: extend-selection ( pane -- )
|
||||||
hand-moved? [
|
hand-moved? [
|
||||||
dup selecting?>> [
|
[
|
||||||
hand-loc get move-caret
|
dup selecting?>> [
|
||||||
] [
|
hand-loc get move-caret
|
||||||
dup hand-clicked get child? [
|
] [
|
||||||
t >>selecting?
|
dup hand-clicked get child? [
|
||||||
dup hand-clicked set-global
|
t >>selecting?
|
||||||
hand-click-loc get move-caret
|
[ hand-clicked set-global ]
|
||||||
caret>mark
|
[ hand-click-loc get move-caret ]
|
||||||
] when
|
[ caret>mark ]
|
||||||
] if
|
tri
|
||||||
dup dup caret>> gadget-at-path scroll>gadget
|
] [ drop ] if
|
||||||
] when drop ;
|
] if
|
||||||
|
] [ dup caret>> gadget-at-path scroll>gadget ] bi
|
||||||
|
] [ drop ] if ;
|
||||||
|
|
||||||
: end-selection ( pane -- )
|
: end-selection ( pane -- )
|
||||||
f >>selecting?
|
f >>selecting?
|
||||||
hand-moved? [
|
hand-moved?
|
||||||
[ com-copy-selection ] [ request-focus ] bi
|
[ [ com-copy-selection ] [ request-focus ] bi ]
|
||||||
] [
|
[ [ relayout-1 ] [ focus-input ] bi ]
|
||||||
relayout-1
|
if ;
|
||||||
] if ;
|
|
||||||
|
|
||||||
: select-to-caret ( pane -- )
|
: select-to-caret ( pane -- )
|
||||||
t >>selecting?
|
t >>selecting?
|
||||||
dup mark>> [ caret>mark ] unless
|
[ dup mark>> [ dup caret>mark ] unless hand-loc get move-caret ]
|
||||||
hand-loc get move-caret
|
[ com-copy-selection ]
|
||||||
dup request-focus
|
[ request-focus ]
|
||||||
com-copy-selection ;
|
tri ;
|
||||||
|
|
||||||
: pane-menu ( pane -- ) { com-copy } show-commands-menu ;
|
: pane-menu ( pane -- ) { com-copy } show-commands-menu ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue