diff options
author | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-04 12:41:48 -0500 |
---|---|---|
committer | anika-ahluwalia <anika.ahluwalia@gmail.com> | 2020-06-04 12:41:48 -0500 |
commit | b3b9d88efdc82650204afff4da3e28f2898c9c20 (patch) | |
tree | a0d5ed5e1df02ae7c5e6dd696f3435a6dfeaa30e /src/client/views/nodes/ScriptingBox.tsx | |
parent | 65ff6d515cd8102c3a4284244f8a84d356ba0c05 (diff) |
fixed list overflow and deleting ()
Diffstat (limited to 'src/client/views/nodes/ScriptingBox.tsx')
-rw-r--r-- | src/client/views/nodes/ScriptingBox.tsx | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 3c268b5cd..a3b11c734 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -48,6 +48,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc @observable private _suggestionBoxX: number = 0; @observable private _suggestionBoxY: number = 0; + @observable private _lastChar: string = ""; @observable private _suggestionRef: any = React.createRef(); @observable private _scriptTextRef: any = React.createRef(); @@ -519,15 +520,31 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<FieldViewProps, Sc } else { console.log(this.rawScript.split("(").length - 1); console.log(this.rawScript.split(")").length - 1); - if (this.rawScript.split("(").length - 1 <= this.rawScript.split(")").length - 1) { - console.log("removed params"); - this._paramSuggestion = false; + if (e.key === "Backspace") { + if (this._lastChar === "(") { + console.log("removed params"); + this._paramSuggestion = false; + } else if (this._lastChar === ")") { + if (this.rawScript.slice(0, this.rawScript.length - 1).split("(").length - 1 > this.rawScript.slice(0, this.rawScript.length - 1).split(")").length - 1) { + if (this._scriptSuggestedParams.length > 0) { + console.log("suggestion params"); + this._paramSuggestion = true; + } + } + } } else { - if (e.key === "Backspace") { + if (this.rawScript.split("(").length - 1 <= this.rawScript.split(")").length - 1) { console.log("removed params"); this._paramSuggestion = false; } } + + } + if (e.key === "Backspace") { + this._lastChar = this.rawScript[this.rawScript.length - 2]; + console.log("last char: " + this._lastChar); + } else { + this._lastChar = e.key; } } |