Skip to content

Introduce Ew2uEnabled flag for w to ư transformation#4

Merged
nhktmdzhg merged 1 commit intoLotusInputMethod:masterfrom
hthienloc:w2u
Mar 24, 2026
Merged

Introduce Ew2uEnabled flag for w to ư transformation#4
nhktmdzhg merged 1 commit intoLotusInputMethod:masterfrom
hthienloc:w2u

Conversation

@hthienloc
Copy link
Copy Markdown

This pull request introduces a new feature flag to control the mapping of the w key to the Vietnamese character ư in the Telex input method, along with related changes to input method definitions and tests. The most important changes are grouped below:

Feature flag addition and logic updates

  • Added a new flag Ew2uEnabled to the engine flags, and updated EstdFlags to include this flag. This allows toggling the behavior of mapping w to ư. (bamboo.go)
  • Updated the transformation generation logic in BambooEngine to convert w or W to ư or Ư when the Ew2uEnabled flag is set. (bamboo.go)

Input method definition changes

  • Modified the Telex input method mapping for w to remove the explicit mapping to Ư when typed alone; now, w only maps to ƯƠĂ. (input_method_def.go)
  • Removed the "Telex W" input method variant, simplifying input method definitions. (input_method_def.go)

Testing updates

  • Added comprehensive tests for the new Ew2uEnabled flag, verifying correct behavior when the flag is on or off, and for different positions and cases of w. (bamboo_test.go)
  • Updated an existing test to use the correct Telex 2 key (]) for ư instead of w, reflecting the updated mapping. (bamboo_test.go)

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the Telex input method by introducing a configurable feature flag, Ew2uEnabled, which allows users to toggle the automatic transformation of the 'w' key to the Vietnamese character 'ư'. This change centralizes the 'w' to 'ư' logic under a single flag, simplifies input method definitions by removing a redundant variant, and enhances test coverage for this specific behavior.

Highlights

  • Feature Flag Introduction: Introduced a new feature flag, Ew2uEnabled, to control the mapping of the w key to the Vietnamese character ư in the Telex input method.
  • Transformation Logic Update: Updated the BambooEngine to conditionally transform w or W to ư or Ư when the Ew2uEnabled flag is active.
  • Input Method Definition Refinement: Modified the standard Telex input method's w mapping to remove the explicit ư transformation when typed alone, and removed the redundant "Telex W" input method variant.
  • Testing Enhancements: Added comprehensive tests for the new Ew2uEnabled flag, verifying its behavior, and updated an existing test to correctly use the Telex 2 key for ư.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a feature flag Ew2uEnabled to make the w to ư transformation optional in the Telex input method. The implementation correctly adds the flag and updates the transformation logic. The input method definitions are also simplified by removing the now-redundant 'Telex W' variant. The changes are well-tested. I've left a couple of suggestions to improve code clarity and remove some redundant logic.

Comment on lines +127 to +133
if transformations[0].Rule.Result == 'w' {
transformations[0].Rule.Result = 'ư'
transformations[0].Rule.EffectOn = 'ư'
} else if transformations[0].Rule.Result == 'W' {
transformations[0].Rule.Result = 'Ư'
transformations[0].Rule.EffectOn = 'Ư'
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The else if condition checking for transformations[0].Rule.Result == 'W' will never be met. The Rule.Result for an appending transformation is always the lowercase version of the character. The casing is handled by the IsUpperCase flag on the Transformation struct, which is later processed by the Flatten function. This else if block is dead code and should be removed for clarity and to prevent future confusion.

            if transformations[0].Rule.Result == 'w' {
                transformations[0].Rule.Result = 'ư'
                transformations[0].Rule.EffectOn = 'ư'
            }

}

// Flag ON - Start of word
ng = NewEngine(im, EstdFlags|Ew2uEnabled)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The expression EstdFlags|Ew2uEnabled is redundant. Since Ew2uEnabled has been added to the definition of EstdFlags, EstdFlags already includes this flag by default. Using just EstdFlags would be clearer and less prone to confusion.

Suggested change
ng = NewEngine(im, EstdFlags|Ew2uEnabled)
ng = NewEngine(im, EstdFlags)

@nhktmdzhg nhktmdzhg merged commit 588293e into LotusInputMethod:master Mar 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants