mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-22 02:41:23 +01:00
Other key bind bug fixes (#529)
This commit is contained in:
parent
a1e4e807cc
commit
4f6c2ee39b
@ -54,33 +54,34 @@ class SessionKeybindings extends React.Component<{}, {}> {
|
||||
GlobalModel.onBracketCmd(1);
|
||||
return true;
|
||||
});
|
||||
keybindManager.registerKeybinding("pane", "session", "app:selectLineAbove", (waveEvent) => {
|
||||
keybindManager.registerKeybinding("pane", "screen", "app:selectLineAbove", (waveEvent) => {
|
||||
GlobalModel.onMetaArrowUp();
|
||||
return true;
|
||||
});
|
||||
keybindManager.registerKeybinding("pane", "session", "app:selectLineBelow", (waveEvent) => {
|
||||
keybindManager.registerKeybinding("pane", "screen", "app:selectLineBelow", (waveEvent) => {
|
||||
GlobalModel.onMetaArrowDown();
|
||||
return true;
|
||||
});
|
||||
keybindManager.registerKeybinding("pane", "session", "app:restartCommand", (waveEvent) => {
|
||||
keybindManager.registerKeybinding("pane", "screen", "app:restartCommand", (waveEvent) => {
|
||||
GlobalModel.onRestartCommand();
|
||||
return true;
|
||||
});
|
||||
keybindManager.registerKeybinding("pane", "session", "app:restartLastCommand", (waveEvent) => {
|
||||
keybindManager.registerKeybinding("pane", "screen", "app:restartLastCommand", (waveEvent) => {
|
||||
GlobalModel.onRestartLastCommand();
|
||||
return true;
|
||||
});
|
||||
keybindManager.registerKeybinding("pane", "session", "app:focusSelectedLine", (waveEvent) => {
|
||||
keybindManager.registerKeybinding("pane", "screen", "app:focusSelectedLine", (waveEvent) => {
|
||||
GlobalModel.onFocusSelectedLine();
|
||||
return true;
|
||||
});
|
||||
keybindManager.registerKeybinding("pane", "session", "app:deleteActiveLine", (waveEvent) => {
|
||||
keybindManager.registerKeybinding("pane", "screen", "app:deleteActiveLine", (waveEvent) => {
|
||||
return GlobalModel.handleDeleteActiveLine();
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
GlobalModel.keybindManager.unregisterDomain("session");
|
||||
GlobalModel.keybindManager.unregisterDomain("screen");
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -220,7 +221,7 @@ class WorkspaceView extends React.Component<{}, {}> {
|
||||
<i className="fa-solid fa-sharp fa-xmark-large" />
|
||||
</div>
|
||||
<TabSettings key={activeScreen.screenId} screen={activeScreen} />
|
||||
<If condition={showTabSettings}>
|
||||
<If condition={showTabSettings && !isHidden}>
|
||||
<TabSettingsPulldownKeybindings />
|
||||
</If>
|
||||
</div>
|
||||
|
@ -277,6 +277,49 @@ class KeybindManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
processModalLevel(nativeEvent: any, event: WaveKeyboardEvent, keybindsArray: Array<Keybind>): boolean {
|
||||
let curModalDomain: string = "";
|
||||
// iterate through keybinds in backwards order
|
||||
let domainCallbacksToRun: Map<string, KeybindCallback> = new Map();
|
||||
for (let index = keybindsArray.length - 1; index >= 0; index--) {
|
||||
let curKeybind = keybindsArray[index];
|
||||
if (curModalDomain == "") {
|
||||
curModalDomain = curKeybind.domain;
|
||||
}
|
||||
if (curKeybind.domain != curModalDomain) {
|
||||
continue;
|
||||
}
|
||||
if (this.domainCallbacks.has(curKeybind.domain)) {
|
||||
let curDomainCallback = this.domainCallbacks.get(curKeybind.domain);
|
||||
if (curDomainCallback != null) {
|
||||
domainCallbacksToRun.set(curKeybind.domain, curDomainCallback);
|
||||
}
|
||||
}
|
||||
if (this.checkKeyPressed(event, curKeybind.keybinding)) {
|
||||
if (DumpLogs) {
|
||||
console.log("keybind found", curKeybind);
|
||||
}
|
||||
let shouldReturn = false;
|
||||
let shouldRunCommand = true;
|
||||
if (curKeybind.callback != null) {
|
||||
shouldReturn = curKeybind.callback(event);
|
||||
shouldRunCommand = false;
|
||||
}
|
||||
if (shouldRunCommand) {
|
||||
shouldReturn = this.runSlashCommand(curKeybind);
|
||||
}
|
||||
if (shouldReturn) {
|
||||
nativeEvent.preventDefault();
|
||||
nativeEvent.stopPropagation();
|
||||
this.runDomainCallbacks(event, domainCallbacksToRun);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.runDomainCallbacks(event, domainCallbacksToRun);
|
||||
return false;
|
||||
}
|
||||
|
||||
processKeyEvent(nativeEvent: any, event: WaveKeyboardEvent): boolean {
|
||||
let modalLevel = this.levelMap.get("modal");
|
||||
if (modalLevel.length != 0) {
|
||||
@ -287,7 +330,7 @@ class KeybindManager {
|
||||
if (shouldReturn) {
|
||||
return true;
|
||||
}
|
||||
shouldReturn = this.processLevel(nativeEvent, event, modalLevel);
|
||||
shouldReturn = this.processModalLevel(nativeEvent, event, modalLevel);
|
||||
if (shouldReturn) {
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user