diff --git a/src/main.tsx b/src/main.tsx index 9c0098860..f81694079 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -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) {