diff --git a/src/main.tsx b/src/main.tsx
index 8a53a6c1d..6556e5673 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -638,6 +638,14 @@ class TextAreaInput extends React.Component<{}, {}> {
e.preventDefault();
inputModel.giveFocus();
}
+ else {
+ inputModel.setPhysicalInputFocused(true);
+ }
+ }
+
+ @boundMethod
+ handleMainBlur(e : any) {
+ GlobalModel.inputModel.setPhysicalInputFocused(false);
}
@boundMethod
@@ -647,6 +655,14 @@ class TextAreaInput extends React.Component<{}, {}> {
e.preventDefault();
inputModel.giveFocus();
}
+ else {
+ inputModel.setPhysicalInputFocused(true);
+ }
+ }
+
+ @boundMethod
+ handleHistoryBlur(e : any) {
+ GlobalModel.inputModel.setPhysicalInputFocused(false);
}
render() {
@@ -664,7 +680,7 @@ class TextAreaInput extends React.Component<{}, {}> {
}
return (
-
+
);
diff --git a/src/model.ts b/src/model.ts
index af8e1c433..cfe103afa 100644
--- a/src/model.ts
+++ b/src/model.ts
@@ -254,6 +254,7 @@ class ScreenWindow {
layout : OV;
shouldFollow : OV = mobx.observable.box(true);
lastCols : number;
+ selectedLine : OV = mobx.observable.box(null);
// cmdid => TermWrap
terms : Record = {};
@@ -628,6 +629,11 @@ class InputModel {
showNoInputMsg : OV = mobx.observable.box(false);
showNoInputTimeoutId : any = null;
+ // focus
+ inputFocused : OV = mobx.observable.box(false);
+ lineFocused : OV = mobx.observable.box(false);
+ physicalInputFocused : OV = mobx.observable.box(false);
+
constructor() {
this.filteredHistoryItems = mobx.computed(() => {
return this._getFilteredHistoryItems();
@@ -650,6 +656,34 @@ class InputModel {
})();
}
+ onInputFocus(isFocused : boolean) : void {
+ mobx.action(() => {
+ if (isFocused) {
+ this.inputFocused.set(true);
+ this.lineFocused.set(false);
+ }
+ else {
+ if (this.inputFocused.get()) {
+ this.inputFocused.set(false);
+ }
+ }
+ })();
+ }
+
+ onLineFocus(isFocused : boolean) : void {
+ mobx.action(() => {
+ if (isFocused) {
+ this.inputFocused.set(false);
+ this.lineFocused.set(true);
+ }
+ else {
+ if (this.lineFocused.get()) {
+ this.lineFocused.set(false);
+ }
+ }
+ })();
+ }
+
_focusCmdInput() : void {
let elem = document.getElementById("main-cmd-input");
if (elem != null) {
@@ -673,6 +707,12 @@ class InputModel {
}
}
+ setPhysicalInputFocused(isFocused : boolean) : void {
+ mobx.action(() => {
+ this.physicalInputFocused.set(isFocused);
+ })();
+ }
+
getPtyRemoteId() : string {
let info = this.infoMsg.get();
if (info == null || isBlank(info.ptyremoteid)) {