如何更改吱吱声中的自动完成按钮?

时间:2015-02-01 15:10:44

标签: smalltalk squeak

有没有办法在squeak vm(标准是tab)中更改调用自动完成的快捷方式?

提前致谢

1 个答案:

答案 0 :(得分:1)

(我假设您使用了OCompletion或ECompletion)

目前改变这种情况的唯一方法是更改​​代码。

OController>>handleKeystrokeBefore: kbEvent editor: theEditor 
    "I return a boolean. true when I have handled the event and no futher processing is needed by the caller."
    | keyValue ctrl cmd down tab colon alphanum del esc enter up |
    self editor: theEditor.
    self setModel: theEditor model.
    keyValue := kbEvent keyValue.
    ctrl := kbEvent controlKeyPressed.
    cmd := kbEvent commandKeyPressed.
    down := keyValue = 31.
    up := keyValue = 30.
    tab := kbEvent keyCharacter = Character tab. "<-- change this to your desired key"
    enter := kbEvent keyCharacter = Character cr.  
    colon := kbEvent keyCharacter = $:.
    alphanum := kbEvent keyCharacter isAlphaNumeric.
    "..."

或者,当您只使用ECompletion时

ECController>>handleKeystrokeBefore: aKeyboardEvent editor: anEditor 
    "I return a boolean. true when I have handled the event and no futher processing is needed by the caller."

    | theEditor keyValue controlKeyPressed isSpaceKey |
    self editor: anEditor. 
    theEditor := self editor.
    self setModel: theEditor model.
    keyValue := aKeyboardEvent keyValue.
    controlKeyPressed := aKeyboardEvent controlKeyPressed.
    isSpaceKey := #(0 32 ) includes: keyValue.
    "Ctrl-Space or Tab for open"
    self isMenuOpen
        ifFalse: [(isSpaceKey & controlKeyPressed
                    or: [keyValue = 9 "            <-- change this to your desired key"
                            and: [theEditor isCaretBehindChar
                                    and: [controlKeyPressed not]]])
    "..."