Faculty of Information Technology
Software Engineering Group

Ticket #176: smallsense_fix_1_of_1_rev_b6dbdc4fd7f5_Issue__176__fix__disappearing__completon_view_when_pointer_moves_out_of_it.patch

File smallsense_fix_1_of_1_rev_b6dbdc4fd7f5_Issue__176__fix__disappearing__completon_view_when_pointer_moves_out_of_it.patch, 4.2 KB (added by Jan Vrany, 5 years ago)
  • SmallSense__CompletionController.st

    # HG changeset patch
    # User Jan Vrany <jan.vrany@fit.cvut.cz>
    # Date 1521413527 0
    #      Sun Mar 18 22:52:07 2018 +0000
    # Node ID b6dbdc4fd7f53acdca286b9f5e18c98563b3f41c
    # Parent  031924a79f90e2289fe3e75823ad7bc8466d8e5a
    Issue #176: fix "disappearing" completon view when pointer moves out of it
    
    ...by making it a popup view (which it is, of sorts) and opening it modally.
    While this changes the behavior a little, should behave better on windows
    with "focus-follows-mouse".
    
    diff -r 031924a79f90 -r b6dbdc4fd7f5 SmallSense__CompletionController.st
    a b  
    498498            movePos y: (movePos y - windowExtent y - editView font maxHeight - 5).
    499499        ].
    500500        topView origin:movePos.
     501        topView
     502            bePopUpView;
     503            beSlave.
    501504"/        topView resizeToFit.
    502505        self updateSelection ifFalse:[
    503             topView open.
     506            topView openModal.
    504507        ].
    505508    ] ifFalse:[
    506509        completionView list:list.
     
    514517
    515518    "Created: / 27-09-2013 / 14:01:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    516519    "Modified: / 15-05-2014 / 11:30:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     520    "Modified (format): / 15-03-2018 / 10:47:27 / jv"
    517521!
    518522
    519523updateCompletions: completionResult sequence: sequence
  • SmallSense__CompletionView.st

    diff -r 031924a79f90 -r b6dbdc4fd7f5 SmallSense__CompletionView.st
    a b  
    2020
    2121"{ NameSpace: SmallSense }"
    2222
    23 SimpleView subclass:#CompletionView
     23TopView subclass:#CompletionView
    2424        instanceVariableNames:'completionController completionContext list listHolder listView
    2525                selectionHolder helpHolder helpView'
    2626        classVariableNames:''
     
    125125!CompletionView methodsFor:'event handling'!
    126126
    127127keyPress:key x:x y:y
    128     x isNil ifTrue:[
    129         "/ Already re-delegated   
    130         ^ self
    131     ].
    132128    key == #Escape ifTrue:[
    133129        completionController closeCompletionView.
    134130        ^ self
    135     ].
     131    ]. 
    136132    (key == #CursorDown
    137133        or:[ key == #CursorUp
    138         or:[ key == #CursorLeft
    139         or:[ key == #CursorRight
    140         or:[ ((key == #Return) and:[ self hasSelection ])]]]]) ifTrue:[
     134        or:[ ((key == #Return) and:[ self hasSelection ])]]) ifTrue:[
    141135            listView keyPress:key x:x y:y.
    142136            ^ self
    143137        ].
     
    145139    ^ completionController editView keyPress:key x:x y:y
    146140
    147141    "Created: / 27-09-2013 / 14:05:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    148     "Modified: / 31-03-2014 / 22:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    149142    "Modified: / 18-01-2018 / 23:10:58 / jv"
     143    "Modified (comment): / 17-04-2018 / 15:14:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     144!
     145
     146keyPress:key x:x y:y view: view
     147    view == listView ifTrue:[
     148        (key == #CursorDown
     149        or:[ key == #CursorUp
     150        or:[ key == #Return]]) ifTrue:[
     151            ^ false
     152        ] ifFalse:[
     153            completionController editView keyPress:key x:x y:y.
     154            ^ true
     155        ].
     156    ].
     157    ^ false
     158
     159    "Created: / 17-04-2018 / 09:54:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     160    "Modified (comment): / 17-04-2018 / 15:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    150161! !
    151162
    152163!CompletionView methodsFor:'initialization & release'!
     
    168179    listView := listViewScroller scrolledView.
    169180    listView listHolder: listHolder.
    170181    listView model: selectionHolder.
     182    listView delegate: self.
    171183    listView highlightMode: #line.
    172184    listView doubleClickAction:[:index | self complete: index ].
    173185
     
    182194    self extent: 400 @ 250
    183195
    184196    "Created: / 27-09-2013 / 13:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    185     "Modified: / 04-04-2014 / 15:03:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     197    "Modified: / 17-04-2018 / 09:53:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    186198! !
    187199
    188200!CompletionView methodsFor:'queries'!
    189201
     202handlesKeyPress: key inView: view
     203    ^ view == listView and:[ key isCharacter ]
     204
     205    "Created: / 17-04-2018 / 09:55:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     206!
     207
    190208hasSelection
    191209    ^listView hasSelection
    192210