Skip to content

Commit c1c03cf

Browse files
committed
Infer Shift for A-Z in custom bindings
1 parent 8bc665d commit c1c03cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

PSReadLine/ConsoleKeyChordConverter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private static ConsoleKeyInfo GetOneKey(string chord, ref int start)
101101
}
102102
start += input.Length;
103103

104-
if (!MapKeyChar(input, (mods & ConsoleModifiers.Control) != 0, out var key, out var keyChar))
104+
if (!MapKeyChar(input, ref mods, out var key, out var keyChar))
105105
{
106106
throw CantConvert(PSReadLineResources.UnrecognizedKey, input);
107107
}
@@ -221,8 +221,9 @@ struct KeyPair
221221
{ "UpArrow", new KeyPair { Key = ConsoleKey.UpArrow} },
222222
};
223223

224-
static bool MapKeyChar(string input, bool isCtrl, out ConsoleKey key, out char keyChar)
224+
static bool MapKeyChar(string input, ref ConsoleModifiers mods, out ConsoleKey key, out char keyChar)
225225
{
226+
var isCtrl = (mods & ConsoleModifiers.Control) != 0;
226227
if (input.Length == 1)
227228
{
228229
keyChar = input[0];
@@ -233,6 +234,7 @@ static bool MapKeyChar(string input, bool isCtrl, out ConsoleKey key, out char k
233234
else if (keyChar >= 'A' && keyChar <= 'Z')
234235
{
235236
key = ConsoleKey.A + (keyChar - 'A');
237+
mods |= ConsoleModifiers.Shift;
236238
}
237239
else if (keyChar >= '0' && keyChar <= '9')
238240
{

0 commit comments

Comments
 (0)