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

Commit ea1e183

Browse files
committed
Fix onValueChanged bursts
1 parent 8080129 commit ea1e183

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
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.13";
17+
public const string VERSION = "3.3.14";
1818
public const string AUTHOR = "Sinai";
1919
public const string GUID = "com.sinai.unityexplorer";
2020

src/UI/Main/CSConsole/CSharpConsole.cs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -199,23 +199,8 @@ public void InitConsole()
199199
InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
200200
}
201201

202-
internal static bool IsUserCopyPasting()
203-
{
204-
return (InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl))
205-
&& InputManager.GetKeyDown(KeyCode.V);
206-
}
207-
208202
public void UpdateConsole()
209203
{
210-
if (s_copyPasteBuffer != null)
211-
{
212-
if (!IsUserCopyPasting())
213-
{
214-
OnInputChanged(s_copyPasteBuffer);
215-
216-
s_copyPasteBuffer = null;
217-
}
218-
}
219204

220205
if (EnableCtrlRShortcut)
221206
{
@@ -288,16 +273,14 @@ public void UseAutocomplete(string suggestion)
288273
AutoCompleter.ClearAutocompletes();
289274
}
290275

291-
internal static string s_copyPasteBuffer;
276+
private static float s_timeOfLastUpdate;
292277

293278
public void OnInputChanged(string newText, bool forceUpdate = false)
294279
{
295-
if (IsUserCopyPasting())
296-
{
297-
//Console.WriteLine("Copy+Paste detected!");
298-
s_copyPasteBuffer = newText;
280+
if (Time.time <= s_timeOfLastUpdate)
299281
return;
300-
}
282+
283+
s_timeOfLastUpdate = Time.time;
301284

302285
if (EnableAutoIndent)
303286
UpdateIndent(newText);

0 commit comments

Comments
 (0)