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
This commit is contained in:
Cole Lashley 2024-04-26 11:11:03 -07:00 committed by GitHub
parent a449cec33a
commit 4f32c459a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -145,6 +145,7 @@ class AIChat extends React.Component<{}, {}> {
currentRef.value = ""; currentRef.value = "";
} else { } else {
inputModel.grabCodeSelectSelection(); inputModel.grabCodeSelectSelection();
inputModel.setAuxViewFocus(false);
} }
} }

View File

@ -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. // 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 { setAuxViewFocus(focus: boolean): void {
if (this.getAuxViewFocus() == focus) {
return;
}
mobx.action(() => { mobx.action(() => {
this.auxViewFocus.set(focus); this.auxViewFocus.set(focus);
})(); })();
@ -479,6 +476,9 @@ class InputModel {
if (view != null && this.getActiveAuxView() != view) { if (view != null && this.getActiveAuxView() != view) {
return false; return false;
} }
if (view != null && !this.getAuxViewFocus()) {
return false;
}
if (view == null && this.hasFocus() && !this.getAuxViewFocus()) { if (view == null && this.hasFocus() && !this.getAuxViewFocus()) {
return true; return true;
} }
@ -687,6 +687,7 @@ class InputModel {
openAIAssistantChat(): void { openAIAssistantChat(): void {
this.setActiveAuxView(appconst.InputAuxView_AIChat); this.setActiveAuxView(appconst.InputAuxView_AIChat);
this.setAuxViewFocus(true);
this.globalModel.sendActivity("aichat-open"); this.globalModel.sendActivity("aichat-open");
} }