Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 1c5306b

Browse files
committed
Fix the onValueChange throttling affecting internal features
1 parent ea1e183 commit 1c5306b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/ExplorerCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace UnityExplorer
1414
public class ExplorerCore
1515
{
1616
public const string NAME = "UnityExplorer";
17-
public const string VERSION = "3.3.14";
17+
public const string VERSION = "3.3.15";
1818
public const string AUTHOR = "Sinai";
1919
public const string GUID = "com.sinai.unityexplorer";
2020

src/UI/Main/CSConsole/CSharpConsole.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ public void InitConsole()
201201

202202
public void UpdateConsole()
203203
{
204+
if (Time.time > s_timeOfLastInternalSet)
205+
Writing = false;
204206

205207
if (EnableCtrlRShortcut)
206208
{
@@ -259,6 +261,8 @@ internal void UpdateAutocompletes()
259261

260262
public void UseAutocomplete(string suggestion)
261263
{
264+
Writing = true;
265+
262266
string input = InputField.text;
263267
input = input.Insert(m_lastCaretPos, suggestion);
264268
InputField.text = input;
@@ -274,17 +278,31 @@ public void UseAutocomplete(string suggestion)
274278
}
275279

276280
private static float s_timeOfLastUpdate;
281+
private static bool Writing
282+
{
283+
get => s_writing;
284+
set
285+
{
286+
if (value)
287+
s_timeOfLastInternalSet = Time.time;
288+
s_writing = value;
289+
}
290+
}
291+
private static bool s_writing;
292+
private static float s_timeOfLastInternalSet;
277293

278294
public void OnInputChanged(string newText, bool forceUpdate = false)
279295
{
280-
if (Time.time <= s_timeOfLastUpdate)
296+
if (!Writing && Time.time <= s_timeOfLastUpdate)
281297
return;
282298

283299
s_timeOfLastUpdate = Time.time;
284300

285301
if (EnableAutoIndent)
286302
UpdateIndent(newText);
287303

304+
Writing = true;
305+
288306
if (!forceUpdate && string.IsNullOrEmpty(newText))
289307
inputHighlightText.text = string.Empty;
290308
else
@@ -361,6 +379,8 @@ private string SyntaxHighlightContent(string inputText)
361379

362380
private void AutoIndentCaret()
363381
{
382+
Writing = true;
383+
364384
if (CurrentIndent > 0)
365385
{
366386
string indent = GetAutoIndentTab(CurrentIndent);

0 commit comments

Comments
 (0)