add control-P and control-N

This commit is contained in:
sawka 2023-03-23 10:00:45 -07:00
parent 36a6dd2a9e
commit 74da2ff828

View File

@ -241,6 +241,16 @@ class TextAreaInput extends React.Component<{onHeightChange : () => void}, {}> {
this.controlU();
return;
}
if (e.code == "KeyP" && e.getModifierState("Control")) {
e.preventDefault();
this.controlP();
return;
}
if (e.code == "KeyN" && e.getModifierState("Control")) {
e.preventDefault();
this.controlN();
return;
}
if (e.code == "KeyW" && e.getModifierState("Control")) {
e.preventDefault();
this.controlW();
@ -379,6 +389,16 @@ class TextAreaInput extends React.Component<{onHeightChange : () => void}, {}> {
inputModel.moveHistorySelection(e.code == "PageUp" ? 10 : -10);
return;
}
if (e.code == "KeyP" && e.getModifierState("Control")) {
e.preventDefault();
inputModel.moveHistorySelection(1);
return;
}
if (e.code == "KeyN" && e.getModifierState("Control")) {
e.preventDefault();
inputModel.moveHistorySelection(-1);
return;
}
}
@boundMethod
@ -399,6 +419,25 @@ class TextAreaInput extends React.Component<{onHeightChange : () => void}, {}> {
GlobalModel.inputModel.updateCmdLine(cmdLineUpdate);
}
@boundMethod
controlP(e : any) {
let inputModel = GlobalModel.inputModel;
if (!inputModel.isHistoryLoaded()) {
this.lastHistoryUpDown = true;
inputModel.loadHistory(false, 1, "screen");
return;
}
inputModel.moveHistorySelection(1);
this.lastHistoryUpDown = true;
}
@boundMethod
controlN(e : any) {
let inputModel = GlobalModel.inputModel;
inputModel.moveHistorySelection(-1);
this.lastHistoryUpDown = true;
}
@boundMethod
controlW() {
if (this.mainInputRef.current == null) {