Skip to content

read surrounding text#376

Merged
eagleoflqj merged 2 commits into
masterfrom
surrounding-text
Jun 2, 2026
Merged

read surrounding text#376
eagleoflqj merged 2 commits into
masterfrom
surrounding-text

Conversation

@eagleoflqj

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for reading and forwarding the client’s surrounding text/selection info from the macOS InputMethodKit layer into the fcitx input context, so fcitx can make better context-dependent decisions (e.g., around selection/caret behavior).

Changes:

  • Collect surrounding text + cursor/anchor in Swift and pass them into process_key(...).
  • Extend the C++ frontend key event path to accept surrounding text and update InputContext surrounding text state.
  • Enable CapabilityFlag::SurroundingText when not in password mode.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/controller.swift Captures surrounding text/cursor/anchor per key event and forwards them to process_key.
macosfrontend/macosfrontend.swift Implements getSurroundingText(...) using IMKTextInput APIs.
macosfrontend/macosfrontend.h Extends keyEvent(...) signature; adds setSurroundingText(...) and cached last values.
macosfrontend/macosfrontend.cpp Plumbs surrounding text into keyEvent(...), stores it on the input context, and sets SurroundingText capability when appropriate.
macosfrontend/macosfrontend-public.h Updates the exported process_key(...) signature to include surrounding text + cursor/anchor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/controller.swift
Comment thread macosfrontend/macosfrontend.swift Outdated
Comment thread macosfrontend/macosfrontend.swift
Comment thread macosfrontend/macosfrontend.cpp
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

arm64 comparison

No difference.

x86_64 comparison

No difference.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread macosfrontend/macosfrontend.swift
Comment thread macosfrontend/macosfrontend.swift
Comment thread src/controller.swift
@eagleoflqj eagleoflqj merged commit df5e911 into master Jun 2, 2026
13 of 15 checks passed
@eagleoflqj eagleoflqj deleted the surrounding-text branch June 2, 2026 00:02
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