[PR #329] [MERGED] fix: uppercase characters when Option modifier is pressed #336

Closed
opened 2026-05-05 05:13:35 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/keycastr/keycastr/pull/329
Author: @Hephaest
Created: 6/27/2025
Status: Merged
Merged: 8/3/2025
Merged by: @akitchen

Base: mainHead: main


📝 Commits (3)

  • 1155a92 fix: uppercase characters when Option modifier is pressed
  • 2819a42 test: create unit test cases for KCEventTransformer
  • 62dcaf7 test: update test case & change option key handlings

📊 Changes

2 files changed (+4 additions, -4 deletions)

View changed files

📝 keycastr/KCEventTransformer.m (+2 -2)
📝 keycastr/KCVisualizerTests/KCKeystrokeConversionTests.m (+2 -2)

📄 Description

Description

When pressing Option+character (e.g., Option+L), the displayed keystroke was showing lowercase characters (⌥l) while Command+character correctly showed uppercase (⌘L).

https://github.com/user-attachments/assets/98ec19b4-4d23-4d7f-a151-1850a02d4800

Changlog

The fix updates the condition to include the Option modifier flag, ensuring consistent behavior across all modifier keys.

Root Cause

This bug seems to be caused by the isCommand flag only checking for Control and Command modifiers, but not Option.

// KCEventTransformer.m
BOOL isCommand = (_modifiers & (NSEventModifierFlagControl | NSEventModifierFlagCommand)) != 0; // ← here!

// Commands and shifted keystrokes should be uppercased
if (isCommand || hasShiftModifier)
{
    // Unless it is a special case - do not shift keycode 27
    if (keystroke.keyCode != 27) {
        mutableResponse = [[mutableResponse uppercaseString] mutableCopy];
    }
}

Demo

https://github.com/user-attachments/assets/be471143-c86f-40cd-8907-f02870412a8f


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/keycastr/keycastr/pull/329 **Author:** [@Hephaest](https://github.com/Hephaest) **Created:** 6/27/2025 **Status:** ✅ Merged **Merged:** 8/3/2025 **Merged by:** [@akitchen](https://github.com/akitchen) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`1155a92`](https://github.com/keycastr/keycastr/commit/1155a9288b3e427f67aa6ada1465a329a51ff6d1) fix: uppercase characters when Option modifier is pressed - [`2819a42`](https://github.com/keycastr/keycastr/commit/2819a42877c42a05e8be8053759bc4c7689ba41e) test: create unit test cases for KCEventTransformer - [`62dcaf7`](https://github.com/keycastr/keycastr/commit/62dcaf74d007200904a9227163205e8063e2773a) test: update test case & change option key handlings ### 📊 Changes **2 files changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `keycastr/KCEventTransformer.m` (+2 -2) 📝 `keycastr/KCVisualizerTests/KCKeystrokeConversionTests.m` (+2 -2) </details> ### 📄 Description ## Description When pressing Option+character (e.g., Option+L), the displayed keystroke was showing lowercase characters (⌥l) while Command+character correctly showed uppercase (⌘L). https://github.com/user-attachments/assets/98ec19b4-4d23-4d7f-a151-1850a02d4800 ## Changlog The fix updates the condition to include the Option modifier flag, ensuring consistent behavior across all modifier keys. ## Root Cause This bug seems to be caused by the `isCommand` flag only checking for Control and Command modifiers, but not Option. ```objectivec // KCEventTransformer.m BOOL isCommand = (_modifiers & (NSEventModifierFlagControl | NSEventModifierFlagCommand)) != 0; // ← here! // Commands and shifted keystrokes should be uppercased if (isCommand || hasShiftModifier) { // Unless it is a special case - do not shift keycode 27 if (keystroke.keyCode != 27) { mutableResponse = [[mutableResponse uppercaseString] mutableCopy]; } } ``` ## Demo https://github.com/user-attachments/assets/be471143-c86f-40cd-8907-f02870412a8f --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 05:13:35 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/keycastr#336
No description provided.