Repository: microsoft/PowerToys
File: src/modules/poweraccent/PowerAccentKeyboardService/KeyboardListener.cpp (C++)

Code before:
                m_nextCharCb(TriggerKey::Left, m_leftShiftPressed || m_rightShiftPressed);
            }
            else if (triggerPressed == VK_RIGHT)
            {
                Logger::info(L"Next toolbar position - right");
                m_nextCharCb(TriggerKey::Right, m_leftShiftPressed || m_rightShiftPressed);
            }
            else if (triggerPressed == VK_SPACE)
            {
                Logger::info(L"Next toolbar position - space");
                m_nextCharCb(TriggerKey::Space, m_leftShiftPressed || m_rightShiftPressed);
            }

            return true;
        }

        return false;
    }

    bool KeyboardListener::OnKeyUp(KBDLLHOOKSTRUCT info) noexcept
    {
        if (m_leftShiftPressed && info.vkCode == VK_LSHIFT)
        {
            m_leftShiftPressed = false;
        }
        else if (m_rightShiftPressed && info.vkCode == VK_RSHIFT)
        {
            m_rightShiftPressed = false;
        }

        if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters) && m_isLanguageLetterCb(static_cast<LetterKey>(info.vkCode)))
        {
            letterPressed = LetterKey::None;

            if (m_toolbarVisible)
            {
                if (m_stopwatch.elapsed() < m_settings.inputTime)
                {
                    Logger::debug(L"Activation too fast. Do nothing.");

                    // False start, we should output the space if it was the trigger.
                    if (m_triggeredWithSpace)
                    {
                        m_hideToolbarCb(InputType::Space);
                    }
                    else
                    {
                        m_hideToolbarCb(InputType::None);
                    }
                    m_toolbarVisible = false;
                    return true;

Review comment (suggestion):
```suggestion
        if (m_rightShiftPressed && info.vkCode == VK_RSHIFT)
```

Code after:
                m_nextCharCb(TriggerKey::Left, m_leftShiftPressed || m_rightShiftPressed);
            }
            else if (triggerPressed == VK_RIGHT)
            {
                Logger::debug(L"Next toolbar position - right");
                m_nextCharCb(TriggerKey::Right, m_leftShiftPressed || m_rightShiftPressed);
            }
            else if (triggerPressed == VK_SPACE)
            {
                Logger::debug(L"Next toolbar position - space");
                m_nextCharCb(TriggerKey::Space, m_leftShiftPressed || m_rightShiftPressed);
            }

            return true;
        }

        return false;
    }

    bool KeyboardListener::OnKeyUp(KBDLLHOOKSTRUCT info) noexcept
    {
        if (m_leftShiftPressed && info.vkCode == VK_LSHIFT)
        {
            m_leftShiftPressed = false;
        }

        if (m_rightShiftPressed && info.vkCode == VK_RSHIFT)
        {
            m_rightShiftPressed = false;
        }

        if (std::find(std::begin(letters), end(letters), static_cast<LetterKey>(info.vkCode)) != end(letters) && m_isLanguageLetterCb(static_cast<LetterKey>(info.vkCode)))
        {
            letterPressed = LetterKey::None;

            if (m_toolbarVisible)
            {
                if (m_stopwatch.elapsed() < m_settings.inputTime)
                {
                    Logger::debug(L"Activation too fast. Do nothing.");

                    // False start, we should output the space if it was the trigger.
                    if (m_triggeredWithSpace)
                    {
                        m_hideToolbarCb(InputType::Space);
                    }
                    else
                    {
                        m_hideToolbarCb(InputType::None);
                    }
                    m_toolbarVisible = false;