diff --git a/src/main.tsx b/src/main.tsx index 5638f70c..65f8fbdf 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -13,7 +13,7 @@ import type * as T from "./types"; import localizedFormat from 'dayjs/plugin/localizedFormat'; import {GlobalModel, GlobalCommandRunner, Session, Cmd, ScreenLines, Screen, riToRPtr, TabColors, RemoteColors} from "./model"; import {windowWidthToCols, windowHeightToRows, termHeightFromRows, termWidthFromCols, getMonoFontSize} from "./textmeasure"; -import {isModKeyPress, boundInt, sortAndFilterRemotes, makeExternLink, isBlank} from "./util"; +import {isModKeyPress, boundInt, sortAndFilterRemotes, makeExternLink, isBlank, hasNoModifiers} from "./util"; import {BookmarksView} from "./bookmarks"; import {WebShareView} from "./webshare-client-view"; import {HistoryView} from "./history"; @@ -279,12 +279,7 @@ class TextAreaInput extends React.Component<{onHeightChange : () => void}, {}> { inputModel.openHistory(); return; } - if (e.code == "ArrowUp" && e.getModifierState("Shift")) { - e.preventDefault(); - inputModel.openHistory(); - return; - } - if (e.code == "ArrowUp" || e.code == "ArrowDown") { + if ((e.code == "ArrowUp" || e.code == "ArrowDown") && hasNoModifiers(e)) { if (!inputModel.isHistoryLoaded()) { if (e.code == "ArrowUp") { this.lastHistoryUpDown = true; diff --git a/src/util.ts b/src/util.ts index dbbce61b..3fb741dc 100644 --- a/src/util.ts +++ b/src/util.ts @@ -344,4 +344,8 @@ function isBoolEq(b1 : boolean, b2 : boolean) { return (!!b1) == (!!b2); } -export {handleJsonFetchResponse, base64ToArray, genMergeData, genMergeDataMap, genMergeSimpleData, parseEnv0, boundInt, isModKeyPress, incObs, isBlank, loadFonts, getTodayStr, getYesterdayStr, getDateStr, sortAndFilterRemotes, makeExternLink, isStrEq, isBoolEq}; +function hasNoModifiers(e : any) : boolean { + return !e.getModifierState("Shift") && !e.getModifierState("Control") && !e.getModifierState("Meta") && !e.getModifierState("Alt"); +} + +export {handleJsonFetchResponse, base64ToArray, genMergeData, genMergeDataMap, genMergeSimpleData, parseEnv0, boundInt, isModKeyPress, incObs, isBlank, loadFonts, getTodayStr, getYesterdayStr, getDateStr, sortAndFilterRemotes, makeExternLink, isStrEq, isBoolEq, hasNoModifiers};