Faculty of Information Technology
Software Engineering Group

Ticket #176: smallsense_fix_1_of_1_rev_031924a79f90_Issue__176__fix_handling_of_keyboard_events_when_completion_view_has_focus_.patch

File smallsense_fix_1_of_1_rev_031924a79f90_Issue__176__fix_handling_of_keyboard_events_when_completion_view_has_focus_.patch, 2.1 KB (added by Jan Vrany, 22 months ago)

Fix for keyboard issues including the Escape key handling

  • SmallSense__CompletionController.st

    # HG changeset patch
    # User Jan Vrany <jan.vrany@fit.cvut.cz>
    # Date 1516318265 0
    #      Thu Jan 18 23:31:05 2018 +0000
    # Node ID 031924a79f90e2289fe3e75823ad7bc8466d8e5a
    # Parent  3e56a34918b6158a9f00e0681103eb0d03e63399
    Issue #176: fix handling of keyboard events when completion view has focus.
    
    When a completion view has a focus, forward all events to
    the edit text view except cursor movements (should change
    selection in completion list) and enter (should complete).
    
    This should fix problems shown in second video attached to
    the ticket, namely it should fix the annoying problem of not
    reacting to Escape key.
    
    https://swing.fit.cvut.cz/projects/stx-jv/ticket/176
    
    diff -r 3e56a34918b6 -r 031924a79f90 SmallSense__CompletionController.st
    a b  
    7171    "Created: / 18-05-2014 / 11:58:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    7272!
    7373
     74editView
     75    ^ editView
     76!
     77
    7478environment
    7579    ^ support notNil
    7680        ifTrue:[support environment]
  • SmallSense__CompletionView.st

    diff -r 3e56a34918b6 -r 031924a79f90 SmallSense__CompletionView.st
    a b  
    129129        "/ Already re-delegated   
    130130        ^ self
    131131    ].
    132     ^ listView keyPress:key x:x y:y
     132    key == #Escape ifTrue:[
     133        completionController closeCompletionView.
     134        ^ self
     135    ].
     136    (key == #CursorDown
     137        or:[ key == #CursorUp
     138        or:[ key == #CursorLeft
     139        or:[ key == #CursorRight
     140        or:[ ((key == #Return) and:[ self hasSelection ])]]]]) ifTrue:[
     141            listView keyPress:key x:x y:y.
     142            ^ self
     143        ].
     144
     145    ^ completionController editView keyPress:key x:x y:y
    133146
    134147    "Created: / 27-09-2013 / 14:05:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    135148    "Modified: / 31-03-2014 / 22:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    136     "Modified: / 14-12-2017 / 23:17:22 / jv"
     149    "Modified: / 18-01-2018 / 23:10:58 / jv"
    137150! !
    138151
    139152!CompletionView methodsFor:'initialization & release'!