mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix crash when terminal is reset (#6777)
* fix crash when terminal is reset * fix check before removing characters
This commit is contained in:
committed by
Aditya Patwardhan
parent
1de9fb5589
commit
793160228a
@@ -1790,11 +1790,18 @@ namespace Microsoft.PowerShell
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle case where terminal gets reset and the index is outside of the buffer
|
||||
if (index > s.Length)
|
||||
{
|
||||
index = s.Length;
|
||||
}
|
||||
|
||||
// Modify string
|
||||
if (!insertMode) // then overwrite mode
|
||||
if (!insertMode && index < s.Length) // then overwrite mode
|
||||
{
|
||||
s = s.Remove(index, 1);
|
||||
}
|
||||
|
||||
s = s.Insert(index, keyInfo.KeyChar.ToString());
|
||||
index++;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user