insertModifiers method
Replaces each * in action with the xterm modifier parameter for
the event's modifiers (2 Shift, 3 Alt, 4 Shift+Alt, 5 Control,
6 Shift+Control, 7 Control+Alt, 8 all three). Without modifiers
action is returned unchanged.
Implementation
String insertModifiers(TerminalKeyboardEvent event, String action) {
String? code;
if (event.shift && event.alt && event.ctrl) {
code = '8';
} else if (event.ctrl && event.alt) {
code = '7';
} else if (event.shift && event.ctrl) {
code = '6';
} else if (event.ctrl) {
code = '5';
} else if (event.shift && event.alt) {
code = '4';
} else if (event.alt) {
code = '3';
} else if (event.shift) {
code = '2';
}
if (code != null) {
return action.replaceAll('*', code);
}
return action;
}