From 4f32c459a68bc216483baf8610d78bc480907cac Mon Sep 17 00:00:00 2001 From: Cole Lashley Date: Fri, 26 Apr 2024 11:11:03 -0700 Subject: [PATCH] Small aux view fixes that make cmdinput focus work a bit better (#594) * added some more fixes for aichat and cmdinput * removed comments and fixed up merge conflicts * small fix * fixed bug --- src/app/workspace/cmdinput/aichat.tsx | 1 + src/models/input.ts | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/workspace/cmdinput/aichat.tsx b/src/app/workspace/cmdinput/aichat.tsx index 3296704b..544210b0 100644 --- a/src/app/workspace/cmdinput/aichat.tsx +++ b/src/app/workspace/cmdinput/aichat.tsx @@ -145,6 +145,7 @@ class AIChat extends React.Component<{}, {}> { currentRef.value = ""; } else { inputModel.grabCodeSelectSelection(); + inputModel.setAuxViewFocus(false); } } diff --git a/src/models/input.ts b/src/models/input.ts index 39657922..c10b5c94 100644 --- a/src/models/input.ts +++ b/src/models/input.ts @@ -464,9 +464,6 @@ class InputModel { // Sets the focus state of the auxiliary view. If true, the view will get focus. Otherwise, the main input will get focus. setAuxViewFocus(focus: boolean): void { - if (this.getAuxViewFocus() == focus) { - return; - } mobx.action(() => { this.auxViewFocus.set(focus); })(); @@ -479,6 +476,9 @@ class InputModel { if (view != null && this.getActiveAuxView() != view) { return false; } + if (view != null && !this.getAuxViewFocus()) { + return false; + } if (view == null && this.hasFocus() && !this.getAuxViewFocus()) { return true; } @@ -687,6 +687,7 @@ class InputModel { openAIAssistantChat(): void { this.setActiveAuxView(appconst.InputAuxView_AIChat); + this.setAuxViewFocus(true); this.globalModel.sendActivity("aichat-open"); }