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

Code before:
                    triggerPressed = 0;
                    Logger::debug(L"Reset trigger key");
                }
            }
        }

        if (!m_toolbarVisible && letterPressed != LetterKey::None && triggerPressed && !IsForegroundAppExcluded())
        {
            Logger::debug(L"Show toolbar. Letter: {}, Trigger: {}", letterPressed, triggerPressed);

            // Keep track if it was triggered with space so that it can be typed on false starts.
            m_triggeredWithSpace = triggerPressed == VK_SPACE;
            m_toolbarVisible = true;
            m_showToolbarCb(letterPressed);
        }

        if (m_toolbarVisible && triggerPressed)
        {
            if (triggerPressed == VK_LEFT)
            {
                Logger::info(L"Next toolbar position - left");
                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;
        }


Review comment (bug):
```suggestion
                Logger::debug(L"Next toolbar position - right");
```

Code after:
                    triggerPressed = 0;
                    Logger::debug(L"Reset trigger key");
                }
            }
        }

        if (!m_toolbarVisible && letterPressed != LetterKey::None && triggerPressed && !IsForegroundAppExcluded())
        {
            Logger::debug(L"Show toolbar. Letter: {}, Trigger: {}", letterPressed, triggerPressed);

            // Keep track if it was triggered with space so that it can be typed on false starts.
            m_triggeredWithSpace = triggerPressed == VK_SPACE;
            m_toolbarVisible = true;
            m_showToolbarCb(letterPressed);
        }

        if (m_toolbarVisible && triggerPressed)
        {
            if (triggerPressed == VK_LEFT)
            {
                Logger::debug(L"Next toolbar position - left");
                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;
        }