updates for new compgen

This commit is contained in:
sawka
2022-11-10 18:52:38 -08:00
parent b8d4bb071a
commit 5fa7aa52d3
3 changed files with 16 additions and 9 deletions
+9
View File
@@ -520,6 +520,14 @@ class TextAreaInput extends React.Component<{}, {}> {
}
this.lastFocusType = focusType;
}
let inputModel = GlobalModel.inputModel;
if (inputModel.forceCursorPos.get() != null) {
if (this.mainInputRef.current != null) {
this.mainInputRef.current.selectionStart = inputModel.forceCursorPos.get();
this.mainInputRef.current.selectionEnd = inputModel.forceCursorPos.get();
}
mobx.action(() => inputModel.forceCursorPos.set(null))();
}
}
getLinePos(elem : any) : {numLines : number, linePos : number} {
@@ -768,6 +776,7 @@ class TextAreaInput extends React.Component<{}, {}> {
let model = GlobalModel;
let inputModel = model.inputModel;
let curLine = inputModel.getCurLine();
let fcp = inputModel.forceCursorPos.get(); // for reaction
let numLines = curLine.split("\n").length;
let displayLines = numLines;
if (displayLines > 5) {
+5 -7
View File
@@ -856,6 +856,9 @@ class InputModel {
showNoInputTimeoutId : any = null;
inputMode : OV<null | "comment" | "global"> = mobx.observable.box(null);
// cursor
forceCursorPos : OV<number> = mobx.observable.box(null);
// focus
inputFocused : OV<boolean> = mobx.observable.box(false);
lineFocused : OV<boolean> = mobx.observable.box(false);
@@ -1077,13 +1080,8 @@ class InputModel {
updateCmdLine(cmdLine : CmdLineUpdateType) : void {
mobx.action(() => {
let curLine = this.getCurLine();
if (curLine.length < cmdLine.insertpos) {
return;
}
let pos = cmdLine.insertpos;
curLine = curLine.substr(0, pos) + cmdLine.insertchars + curLine.substr(pos);
this.setCurLine(curLine);
this.setCurLine(cmdLine.cmdline);
this.forceCursorPos.set(cmdLine.cursorpos);
})();
}
+2 -2
View File
@@ -284,8 +284,8 @@ type HistoryInfoType = {
};
type CmdLineUpdateType = {
insertchars : string,
insertpos : number,
cmdline : string,
cursorpos : number,
};
type RemoteEditType = {