Skip to content

Commit

Permalink
fix shift & cache u
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminiserman committed Jan 11, 2022
1 parent 71dac83 commit e03324e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ToneTyper/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public void Convert()
if (cachedKey.IsApostrophe) // a'3 => a3
{
_inputSimulator.Keyboard.TextEntry((char)receivedKey);

if (receivedKey.IsU)
{
_cached = receivedKey;
return;
}
}
else if (cachedKey.IsStart) // a3 => ǎ
{
Expand Down Expand Up @@ -101,7 +107,7 @@ public void Convert()

foreach (Keys key in _possibleKeys)
{
if (GetAsyncKeyState(key) == -32767) // -32767 == 0b10000000_00000001 => key is down and was pressed since last query
if (key is not Keys.ShiftKey and not Keys.LShiftKey and not Keys.RShiftKey and not Keys.Shift && GetAsyncKeyState(key) == -32767) // -32767 == 0b10000000_00000001 => key is down and was pressed since last query
{
return new Key(key, shift);
}
Expand Down

0 comments on commit e03324e

Please sign in to comment.