Compare commits

...

2 Commits

Author SHA1 Message Date
MrStashley 24bba1305b added openai bug fix 2024-03-27 17:04:34 -07:00
Evan Simkowitz 052645e0df Remove debug statement (#520) 2024-03-27 17:03:01 -07:00
3 changed files with 14 additions and 10 deletions
-1
View File
@@ -312,7 +312,6 @@ const DatePicker: React.FC<DatePickerProps> = ({ selectedDate, format = "MM/DD/Y
};
const handleArrowNavigation = (key: string, currentPart: string) => {
console.log("Arrow key pressed: ", key);
const currentIndex = formatParts.indexOf(currentPart);
let targetInput;
+5 -3
View File
@@ -113,19 +113,21 @@ class AIChat extends React.Component<{}, {}> {
mobx.action(() => {
this.isFocused.set(true);
})();
GlobalModel.inputModel.codeSelectDeselectAndClear();
}
onTextAreaBlur(e: any) {
mobx.action(() => {
this.isFocused.set(false);
})();
GlobalModel.inputModel.codeSelectDeselectAndClear();
}
onTextAreaChange(e: any) {
// set height of textarea based on number of newlines
mobx.action(() => {
this.textAreaNumLines.set(e.target.value.split(/\n/).length);
GlobalModel.inputModel.codeSelectDeselectAll();
GlobalModel.inputModel.codeSelectDeselectAndClear();
})();
}
@@ -150,7 +152,7 @@ class AIChat extends React.Component<{}, {}> {
return;
}
currentRef.setRangeText("\n", currentRef.selectionStart, currentRef.selectionEnd, "end");
GlobalModel.inputModel.codeSelectDeselectAll();
GlobalModel.inputModel.codeSelectDeselectAndClear();
}
onArrowUpPressed(): boolean {
@@ -160,7 +162,7 @@ class AIChat extends React.Component<{}, {}> {
}
if (this.getLinePos(currentRef).linePos > 1) {
// normal up arrow
GlobalModel.inputModel.codeSelectDeselectAll();
GlobalModel.inputModel.codeSelectDeselectAndClear();
return false;
}
GlobalModel.inputModel.codeSelectSelectNextOldestCodeBlock();
+9 -6
View File
@@ -582,7 +582,7 @@ class InputModel {
}
let incBlockIndex = this.codeSelectSelectedIndex.get() + 1;
if (this.codeSelectSelectedIndex.get() == this.codeSelectBlockRefArray.length - 1) {
this.codeSelectDeselectAll();
this.codeSelectDeselectAndClear();
if (this.aiChatWindowRef?.current != null) {
this.aiChatWindowRef.current.scrollTop = this.aiChatWindowRef.current.scrollHeight;
}
@@ -606,7 +606,7 @@ class InputModel {
}
let decBlockIndex = this.codeSelectSelectedIndex.get() - 1;
if (decBlockIndex < 0) {
this.codeSelectDeselectAll(this.codeSelectTop);
this.codeSelectDeselectAndClear(this.codeSelectTop);
if (this.aiChatWindowRef?.current != null) {
this.aiChatWindowRef.current.scrollTop = 0;
}
@@ -629,16 +629,19 @@ class InputModel {
return blockIndex == this.codeSelectSelectedIndex.get();
}
codeSelectDeselectAll(direction: number = this.codeSelectBottom) {
if (this.codeSelectSelectedIndex.get() == direction) {
return;
}
codeSelectDeselectAndClear(direction: number = this.codeSelectBottom) {
mobx.action(() => {
this.codeSelectSelectedIndex.set(direction);
this.codeSelectBlockRefArray = [];
})();
}
codeSelectDeselectAll(direction: number = this.codeSelectBottom) {
mobx.action(() => {
this.codeSelectSelectedIndex.set(direction);
})();
}
openAIAssistantChat(): void {
mobx.action(() => {
this.aIChatShow.set(true);