@@ -73,7 +73,8 @@ public static void RevertLine(ConsoleKeyInfo? key = null, object arg = null)
73
73
_singleton . _edits [ _singleton . _undoEditIndex - 1 ] . Undo ( ) ;
74
74
_singleton . _undoEditIndex -- ;
75
75
}
76
- _singleton . Render ( ) ;
76
+ // Undo has already safely rendered the character removals
77
+ _singleton . SafeRender ( ) ;
77
78
}
78
79
79
80
/// <summary>
@@ -86,8 +87,10 @@ public static void CancelLine(ConsoleKeyInfo? key = null, object arg = null)
86
87
_singleton . _current = _singleton . _buffer . Length ;
87
88
88
89
using var _ = _singleton . _prediction . DisableScoped ( ) ;
90
+ // The behavior of this is as expected under a screen reader
89
91
_singleton . ForceRender ( ) ;
90
92
93
+ // Display a literal ^C in bright red then reset formatting
91
94
_singleton . _console . Write ( "\x1b [91m^C\x1b [0m" ) ;
92
95
93
96
_singleton . _buffer . Clear ( ) ; // Clear so we don't actually run the input
@@ -138,7 +141,8 @@ private static void ForwardDeleteImpl(int endPosition, Action<ConsoleKeyInfo?, o
138
141
! InViEditMode ( ) ) ) ;
139
142
140
143
buffer . Remove ( current , length ) ;
141
- _singleton . Render ( ) ;
144
+ // Moves cursor to current (backwards probably) and then deletes length
145
+ _singleton . SafeRender ( $ "\x1b [{ length } P", current ) ;
142
146
}
143
147
}
144
148
@@ -168,6 +172,7 @@ private static void BackwardDeleteSubstring(int position, Action<ConsoleKeyInfo?
168
172
169
173
_singleton . RemoveTextToViRegister ( position , count , instigator , arg : null , ! InViEditMode ( ) ) ;
170
174
_singleton . _current = position ;
175
+ // TODO: This seems to only be used in Vi mode which we need to evaluate under a screen reader
171
176
_singleton . Render ( ) ;
172
177
}
173
178
}
@@ -268,7 +273,8 @@ private static void UpdateWordCase(bool toUpper)
268
273
Replace ( _singleton . _current , wordlen , word ) ;
269
274
270
275
_singleton . MoveCursor ( endOfWord ) ;
271
- _singleton . Render ( ) ;
276
+ // Replace has already safely rendered the replacement
277
+ _singleton . SafeRender ( ) ;
272
278
}
273
279
274
280
/// <summary>
@@ -311,7 +317,8 @@ public static void CapitalizeWord(ConsoleKeyInfo? key = null, object arg = null)
311
317
}
312
318
313
319
_singleton . MoveCursor ( endOfWord ) ;
314
- _singleton . Render ( ) ;
320
+ // Replace has already safely rendered the replacement
321
+ _singleton . SafeRender ( ) ;
315
322
}
316
323
317
324
private bool AcceptLineImpl ( bool validate )
@@ -337,6 +344,7 @@ private bool AcceptLineImpl(bool validate)
337
344
338
345
if ( renderNeeded )
339
346
{
347
+ // TODO: Evaluate this under a screen reader
340
348
ForceRender ( ) ;
341
349
}
342
350
@@ -363,6 +371,7 @@ private bool AcceptLineImpl(bool validate)
363
371
_statusLinePrompt = "" ;
364
372
_statusBuffer . Append ( errorMessage ) ;
365
373
_statusIsErrorMessage = true ;
374
+ // TODO: Evaluate this under a screen reader
366
375
Render ( ) ;
367
376
return false ;
368
377
}
0 commit comments