Java Code Examples for org.aesh.readline.terminal.Key#getKey()

The following examples show how to use org.aesh.readline.terminal.Key#getKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditMode.java    From aesh-readline with Apache License 2.0 6 votes vote down vote up
default KeyAction createKeyEvent(int[] input) {
    Key key = Key.getKey(input);
    if(key != null)
        return key;
    else {
        return new KeyAction() {
            private int[] key = input;

            @Override
            public int getCodePointAt(int index) throws IndexOutOfBoundsException {
                return key[index];
            }

            @Override
            public int length() {
                return key.length;
            }

            @Override
            public String name() {
                return Arrays.toString(key);
            }
        };
    }
}
 
Example 2
Source File: Vi.java    From aesh-readline with Apache License 2.0 5 votes vote down vote up
@Override
public void addAction(int[] input, String action) {
    Key key = Key.getKey(input);
    if(key != null)
        addAction(key, action);
    else
        keyEventActions.put(createKeyEvent(input),
                new ActionStatus(ActionMapper.mapToAction(action), Status.EDIT, Status.EDIT));
}
 
Example 3
Source File: Vi.java    From aesh-readline with Apache License 2.0 5 votes vote down vote up
public Vi addAction(int[] input, ActionStatus status) {
    Key key = Key.getKey(input);
    if(key != null)
        actions.put(key, status);
    else
        keyEventActions.put(createKeyEvent(input), status);

    return this;
}
 
Example 4
Source File: Vi.java    From aesh-readline with Apache License 2.0 5 votes vote down vote up
public Vi addActionGroup(int[] input, ActionStatusGroup group) {
    Key key = Key.getKey(input);
    if(key != null)
        actionGroups.put(key, group);
    else
        keyEventActionGroups.put(createKeyEvent(input), group);
    return this;
}
 
Example 5
Source File: Emacs.java    From aesh-readline with Apache License 2.0 5 votes vote down vote up
@Override
public void addAction(int[] input, String action) {
    Key key = Key.getKey(input);
    if(key != null)
        actions.put(key, ActionMapper.mapToAction(action));
    else
        keyEventActions.put(createKeyEvent(input), ActionMapper.mapToAction(action));
}