Skip to content

refactor: remove unreachable composition clearing code#1920

Merged
WhiredPlanck merged 1 commit intoosfans:developfrom
ENOA-ANSUL-EDEN:jk
Jan 25, 2026
Merged

refactor: remove unreachable composition clearing code#1920
WhiredPlanck merged 1 commit intoosfans:developfrom
ENOA-ANSUL-EDEN:jk

Conversation

@ENOA-ANSUL-EDEN
Copy link

Remove two pieces of meaningless code in handleCursorUpdate:

  1. The first code block with condition composingText.isNotEmpty() && (statusCached.isComposing || hasMenu) is effectively unreachable. Even if the condition could be satisfied in rare cases, clearing composition at this point would inevitably cause bugs, so it must remain unreachable.

  2. Calling finishComposingText() when !statusCached.isComposing is nonsensical, as it attempts to finish composing when there is no composing state.

Pull request

Issue tracker

Fixes will automatically close the related issues

Fixes #
Fixes #

Feature

Describe features of this pull request

Code of conduct

Code style

Build pass

  • make debug

Manually test

  • Done

Code Review

  1. No wildcards import
  2. Manual build and test pass
  3. GitHub Action CI pass
  4. At least one contributor review and approve
  5. Merged clean without conflicts
  6. PR will be merged by rebase upstream base

Daily build

Login and download artifact at https://github.com/osfans/trime/actions

Additional Info

Remove two pieces of meaningless code in handleCursorUpdate:

1. The first code block with condition `composingText.isNotEmpty() && (statusCached.isComposing || hasMenu)`
   is effectively unreachable. Even if the condition could be satisfied in rare cases,
   clearing composition at this point would inevitably cause bugs, so it must remain unreachable.

2. Calling finishComposingText() when `!statusCached.isComposing` is nonsensical,
   as it attempts to finish composing when there is no composing state.

Co-authored-by: WhiredPlanck <whiredplanck@outlook.com>
@WhiredPlanck WhiredPlanck merged commit 9ee65a3 into osfans:develop Jan 25, 2026
3 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