fix: preserve keyboard operators during input cleanup#206
Merged
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR adjusts input normalization and fault-tolerance logic so keyboard-entered ASCII and full‑width operators are preserved and normalized consistently, and point fault tolerance on expressions does not overwrite the operator at the split point. Sequence diagram for updated input normalization and point fault tolerancesequenceDiagram
actor User
participant InputEdit
participant ExpressionBar
User->>InputEdit: handleTextChanged(text)
InputEdit->>InputEdit: normalize decimal separator
InputEdit->>InputEdit: replace ASCII/fullwidth operators
InputEdit->>InputEdit: filter with allowedStatic
User->>ExpressionBar: pointFaultTolerance(text)
ExpressionBar->>ExpressionBar: split leftitem, rightitem at operator
ExpressionBar->>InputEdit: symbolFaultTolerance(leftitem)
ExpressionBar->>ExpressionBar: replace left side
ExpressionBar->>InputEdit: symbolFaultTolerance(rightitem)
ExpressionBar->>ExpressionBar: replace right side [operator preserved]
ExpressionBar-->>User: result
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The operator normalization logic (full-width/ASCII variants for +, -, *, /, parentheses, etc.) is duplicated and slightly diverging between
normalizedExprandreformatStr; consider extracting this into a shared helper to keep behavior consistent and easier to maintain. - The
allowedStaticstring now includes both normalized and raw operator forms (+-×÷+-*/); double-check that this set matches the intended normalization pipeline and that operators aren’t unintentionally allowed or disallowed at different stages.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The operator normalization logic (full-width/ASCII variants for +, -, *, /, parentheses, etc.) is duplicated and slightly diverging between `normalizedExpr` and `reformatStr`; consider extracting this into a shared helper to keep behavior consistent and easier to maintain.
- The `allowedStatic` string now includes both normalized and raw operator forms (`+-×÷+-*/`); double-check that this set matches the intended normalization pipeline and that operators aren’t unintentionally allowed or disallowed at different stages.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Skip the current operator when applying right-side symbol fault tolerance. This prevents expressions like 89*2 from being rewritten as 892 after Qt6 operator matching fixes made the cleanup branch active. Log: 修复乘号输入后被容错清理误删的问题 Influence: 修复键盘输入乘除等运算符后继续输入数字时运算符丢失的问题。
lzwind
approved these changes
Jul 10, 2026
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Normalize keyboard operators before separator formatting so transient ASCII operators are not dropped during text cleanup.
Keep the current operator when applying point fault tolerance to the right side of an expression.
Summary by Sourcery
Preserve keyboard-entered arithmetic operators during input normalization and point fault tolerance so expressions retain their intended operators.
Bug Fixes:
Enhancements: