Skip to content

fix: support direct commits in marked text clients - #1165

Merged
lotem merged 3 commits into
rime:masterfrom
Tsingv:master
Aug 4, 2026
Merged

fix: support direct commits in marked text clients#1165
lotem merged 3 commits into
rime:masterfrom
Tsingv:master

Conversation

@Tsingv

@Tsingv Tsingv commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • synthesize a marked-text phase before direct Rime commits when enabled per app
  • preserve the normal preedit path and scope the workaround to force_marked_text_for_direct_commit
  • enable the workaround for Alacritty (org.alacritty)
  • make package data-file enumeration compatible with macOS basename

Closes #741

Comment thread sources/SquirrelInputController.swift Outdated

let forceMarkedText =
session != 0 &&
rimeAPI.get_option(session, "_force_marked_text_for_direct_commit")

@lotem lotem Aug 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Who sets the option?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I set that in squirrel.custom.yaml, near to ascii_mode, like this:
Snapzy_2026-08-04_12-34-56_542

@lotem lotem Aug 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Options that start with _ are cleared if switched to another input schema.

https://github.com/rime/librime/blob/1d0df6e40cdcac17a986adc65e4668ae84ae0ada/src/rime/context.h#L81

I guess the option value should persist thoughout the input session - with its lifetime bound to the conntected app. Do not start with _.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the quick fix.

For the PR to be self-contained, please also update data/squirrel.yaml (in a new commit) to configure known apps that need this workaround.

Comment thread package/add_data_files

data_files=(
$(ls data/plum/* | xargs basename)
$(for file in data/plum/*; do basename "$file"; done)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change is nice to have, but better be in a separate git commit.

Comment thread sources/SquirrelInputController.swift Outdated

let forceMarkedText =
session != 0 &&
rimeAPI.get_option(session, "_force_marked_text_for_direct_commit")

@lotem lotem Aug 4, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Options that start with _ are cleared if switched to another input schema.

https://github.com/rime/librime/blob/1d0df6e40cdcac17a986adc65e4668ae84ae0ada/src/rime/context.h#L81

I guess the option value should persist thoughout the input session - with its lifetime bound to the conntected app. Do not start with _.

// one before accepting insertText.
if forceMarkedText && preedit.isEmpty && !string.isEmpty {
let markedText = NSMutableAttributedString(string: string)
client.setMarkedText(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question:

Is it possible that we always do it when committing text without marked text?

We can experiment with the current solution to see if there are side effects in normal cases, and make it the default behaviour at some point.

@Tsingv

Tsingv commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I’ve split the PR into two commits and corrected the option value name. I’ll also test it by enabling it in the global default features to see how it behaves. For now, though, it may be better to keep it optional.

@lotem

lotem commented Aug 4, 2026

Copy link
Copy Markdown
Member

Thanks for the review. I’ve split the PR into two commits and corrected the option value name. I’ll also test it by enabling it in the global default features to see how it behaves. For now, though, it may be better to keep it optional.

Sounds good.

@lotem

lotem commented Aug 4, 2026

Copy link
Copy Markdown
Member

Great. Feel free to merge the commits when you think it's ready.

@Tsingv

Tsingv commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I think everything looks good on my side.
I’ll do some further testing with this enabled by default, and if that works well, I’ll open a separate PR for it.

@lotem
lotem merged commit 1dde022 into rime:master Aug 4, 2026
1 check 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.

[错误] squirrel 使用 alacritty 终端下无法使用中文符号

2 participants