@@ -61,6 +61,7 @@ class RenderData
61
61
} ;
62
62
private int _initialX ;
63
63
private int _initialY ;
64
+ private bool _waitingToRender ;
64
65
65
66
private ConsoleColor _initialForeground ;
66
67
private ConsoleColor _initialBackground ;
@@ -112,6 +113,7 @@ private void Render()
112
113
_tokens = null ;
113
114
_ast = null ;
114
115
_parseErrors = null ;
116
+ _waitingToRender = true ;
115
117
return ;
116
118
}
117
119
@@ -816,6 +818,7 @@ void UpdateColorsIfNecessary(string newColor)
816
818
// TODO: set WindowTop if necessary
817
819
818
820
_lastRenderTime . Restart ( ) ;
821
+ _waitingToRender = false ;
819
822
}
820
823
821
824
private static string Spaces ( int cnt )
@@ -980,19 +983,24 @@ private void RecomputeInitialCoords()
980
983
981
984
private void MoveCursor ( int newCursor )
982
985
{
983
- // In case the buffer was resized
984
- RecomputeInitialCoords ( ) ;
985
- _previousRender . bufferWidth = _console . BufferWidth ;
986
- _previousRender . bufferHeight = _console . BufferHeight ;
987
-
988
- var point = ConvertOffsetToPoint ( newCursor ) ;
989
- if ( point . Y < 0 )
986
+ // Only update screen cursor if the buffer is fully rendered.
987
+ if ( ! _waitingToRender )
990
988
{
991
- Ding ( ) ;
992
- return ;
989
+ // In case the buffer was resized
990
+ RecomputeInitialCoords ( ) ;
991
+ _previousRender . bufferWidth = _console . BufferWidth ;
992
+ _previousRender . bufferHeight = _console . BufferHeight ;
993
+
994
+ var point = ConvertOffsetToPoint ( newCursor ) ;
995
+ if ( point . Y < 0 )
996
+ {
997
+ Ding ( ) ;
998
+ return ;
999
+ }
1000
+
1001
+ _console . SetCursorPosition ( point . X , point . Y ) ;
993
1002
}
994
1003
995
- _console . SetCursorPosition ( point . X , point . Y ) ;
996
1004
_current = newCursor ;
997
1005
}
998
1006
0 commit comments