AnticipateKeyMap constructor
AnticipateKeyMap({
- KeyBinding? acceptSuggestion,
- KeyBinding? nextSuggestion,
- KeyBinding? prevSuggestion,
- KeyBinding? cancel,
- KeyBinding? deleteCharacterBackward,
Creates an anticipate key map with default bindings.
Implementation
AnticipateKeyMap({
KeyBinding? acceptSuggestion,
KeyBinding? nextSuggestion,
KeyBinding? prevSuggestion,
KeyBinding? cancel,
KeyBinding? deleteCharacterBackward,
}) : acceptSuggestion =
acceptSuggestion ??
KeyBinding(
keys: ['enter', 'tab'],
help: Help(key: '${KeyboardChars.enter}/tab', desc: 'accept'),
),
nextSuggestion =
nextSuggestion ??
KeyBinding(
keys: ['down', 'ctrl+n'],
help: Help(key: Arrows.down, desc: 'next'),
),
prevSuggestion =
prevSuggestion ??
KeyBinding(
keys: ['up', 'ctrl+p'],
help: Help(key: Arrows.up, desc: 'prev'),
),
cancel =
cancel ??
KeyBinding(
keys: ['esc', 'ctrl+c'],
help: Help(key: 'esc', desc: 'cancel'),
),
deleteCharacterBackward =
deleteCharacterBackward ??
KeyBinding(
keys: ['backspace', 'ctrl+h'],
help: Help(key: KeyboardChars.backspace, desc: 'delete char'),
) {
shortHelp = [this.acceptSuggestion, this.cancel];
fullHelp = [
[this.acceptSuggestion, this.cancel],
[this.nextSuggestion, this.prevSuggestion],
];
}