Input Completion Improvements

clean-linux-x86-64
kusumotonorio 2019-08-10 22:02:17 +09:00
parent 41db42a571
commit bada736a3f
4 changed files with 22 additions and 16 deletions

View File

@ -15,8 +15,6 @@ ui.backend.cocoa.input-methods.editors io.encodings.utf16n
io.encodings.string classes.struct ; io.encodings.string classes.struct ;
IN: ui.backend.cocoa.views IN: ui.backend.cocoa.views
SLOT: window
: send-mouse-moved ( view event -- ) : send-mouse-moved ( view event -- )
[ mouse-location ] [ drop window ] 2bi [ mouse-location ] [ drop window ] 2bi
[ move-hand fire-motion yield ] [ drop ] if* ; [ move-hand fire-motion yield ] [ drop ] if* ;
@ -364,10 +362,16 @@ PRIVATE>
METHOD: char validateUserInterfaceItem: id event METHOD: char validateUserInterfaceItem: id event
[ [
self window [ self window :> window
event -> action utf8 alien>string validate-action window [
[ >c-bool ] [ drop self event SUPER-> validateUserInterfaceItem: ] if window world-focus :> gadget
] [ 0 ] if* gadget [
gadget preedit? not [
window event -> action utf8 alien>string validate-action
[ >c-bool ] [ drop self event SUPER-> validateUserInterfaceItem: ] if
] [ 0 ] if
] [ 0 ] if
] [ 0 ] if
] ; ] ;
METHOD: void undo: id event [ self event undo-action send-action$ ] ; METHOD: void undo: id event [ self event undo-action send-action$ ] ;
@ -481,9 +485,11 @@ PRIVATE>
] unless ] unless
gadget preedit? [ gadget preedit? [
gadget [ remove-preedit-text ] [ remove-preedit-info ] bi gadget [ remove-preedit-text ] [ remove-preedit-info ] bi
] when str gadget user-input* drop
str gadget user-input* drop f gadget preedit-selection-mode?<<
f gadget preedit-selection-mode?<< ] [
str window user-input
] if
] [ ] [
str window user-input str window user-input
] if ] if
@ -625,6 +631,8 @@ PRIVATE>
<CGRect> <CGRect>
] ; ] ;
METHOD: void doCommandBySelector: SEL selector [ ] ;
! Initialization ! Initialization
METHOD: void updateFactorGadgetSize: id notification METHOD: void updateFactorGadgetSize: id notification
[ [
@ -634,8 +642,6 @@ PRIVATE>
] when ] when
] ; ] ;
METHOD: void doCommandBySelector: SEL selector [ ] ;
METHOD: id initWithFrame: NSRect frame pixelFormat: id pixelFormat METHOD: id initWithFrame: NSRect frame pixelFormat: id pixelFormat
[ [
self frame pixelFormat SUPER-> initWithFrame:pixelFormat: self frame pixelFormat SUPER-> initWithFrame:pixelFormat:

View File

@ -22,7 +22,7 @@ TUPLE: editor < line-gadget
preedit-underlines ; preedit-underlines ;
M: editor preedit? preedit-start>> [ t ] [ f ] if ; M: editor preedit? preedit-start>> [ t ] [ f ] if ;
<PRIVATE <PRIVATE
: <loc> ( -- loc ) { 0 0 } <model> ; : <loc> ( -- loc ) { 0 0 } <model> ;

View File

@ -401,6 +401,10 @@ M: f request-focus-on 2drop ;
: focus-path ( gadget -- seq ) : focus-path ( gadget -- seq )
[ focus>> ] follow ; [ focus>> ] follow ;
GENERIC: preedit? ( gadget -- ? )
M: gadget preedit? drop f ;
USE: vocabs.loader USE: vocabs.loader
{ "ui.gadgets" "prettyprint" } "ui.gadgets.prettyprint" require-when { "ui.gadgets" "prettyprint" } "ui.gadgets.prettyprint" require-when

View File

@ -63,10 +63,6 @@ M: propagate-key-gesture-tuple send-queued-gesture
[ gesture>> ] [ world>> world-focus ] bi [ gesture>> ] [ world>> world-focus ] bi
[ handle-gesture ] with each-parent drop ; [ handle-gesture ] with each-parent drop ;
GENERIC: preedit? ( gadget -- ? )
M: gadget preedit? drop f ;
:: propagate-key-gesture ( gesture world -- ) :: propagate-key-gesture ( gesture world -- )
world world-focus preedit? [ world world-focus preedit? [
gesture world \ propagate-key-gesture-tuple queue-gesture gesture world \ propagate-key-gesture-tuple queue-gesture