@@ -201,6 +201,8 @@ public void InitConsole()
201
201
202
202
public void UpdateConsole ( )
203
203
{
204
+ if ( Time . time > s_timeOfLastInternalSet )
205
+ Writing = false ;
204
206
205
207
if ( EnableCtrlRShortcut )
206
208
{
@@ -259,6 +261,8 @@ internal void UpdateAutocompletes()
259
261
260
262
public void UseAutocomplete ( string suggestion )
261
263
{
264
+ Writing = true ;
265
+
262
266
string input = InputField . text ;
263
267
input = input . Insert ( m_lastCaretPos , suggestion ) ;
264
268
InputField . text = input ;
@@ -274,17 +278,31 @@ public void UseAutocomplete(string suggestion)
274
278
}
275
279
276
280
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 ;
277
293
278
294
public void OnInputChanged ( string newText , bool forceUpdate = false )
279
295
{
280
- if ( Time . time <= s_timeOfLastUpdate )
296
+ if ( ! Writing && Time . time <= s_timeOfLastUpdate )
281
297
return ;
282
298
283
299
s_timeOfLastUpdate = Time . time ;
284
300
285
301
if ( EnableAutoIndent )
286
302
UpdateIndent ( newText ) ;
287
303
304
+ Writing = true ;
305
+
288
306
if ( ! forceUpdate && string . IsNullOrEmpty ( newText ) )
289
307
inputHighlightText . text = string . Empty ;
290
308
else
@@ -361,6 +379,8 @@ private string SyntaxHighlightContent(string inputText)
361
379
362
380
private void AutoIndentCaret ( )
363
381
{
382
+ Writing = true ;
383
+
364
384
if ( CurrentIndent > 0 )
365
385
{
366
386
string indent = GetAutoIndentTab ( CurrentIndent ) ;
0 commit comments