Skip to content

IME: add surrounding text reporting to text view#1028

Open
dcz-self wants to merge 3 commits intolapce:mainfrom
dcz-self:actions
Open

IME: add surrounding text reporting to text view#1028
dcz-self wants to merge 3 commits intolapce:mainfrom
dcz-self:actions

Conversation

@dcz-self
Copy link
Contributor

@dcz-self dcz-self commented Feb 6, 2026

I didn't touch the editor widget because I already failed to work with it once. Help appreciated.

Because the editor still doesn't support setting surrounding text, I had to add the capability conditionally when requesting IME, so set_ime_allowed now needs more ceremony to set up, and so I move it to View::update.

In the end it's for the best, because without sending all state updates at once, the input method experience is a blinkfest. So it's better to set up everything when it's ready.

@dcz-self dcz-self force-pushed the actions branch 2 times, most recently from 436522f to d4e5d12 Compare February 6, 2026 12:54
@dcz-self
Copy link
Contributor Author

dcz-self commented Feb 6, 2026

I'm not sure what to do with str.floor_char_boundary(). It needs a newer Rust version.

Should I reimplement it as a trait? A function?

@dcz-self dcz-self force-pushed the actions branch 2 times, most recently from 186f1dd to 340e762 Compare February 6, 2026 16:32
Copy link
Collaborator

@jrmoulton jrmoulton left a comment

Choose a reason for hiding this comment

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

The ime code generally looks good to me. The biggest thing here is I don't want to be duplicating the widget gallery for this ime example. any change (which I can't tell what they are if there are any) can just be made to the widget gallery directly. @ArthurCose if you have time could you look this over?

Cargo.toml Outdated

[patch.crates-io]
#sctk = { git = "https://github.com/dcz-self/client-toolkit.git", branch = "sync2", package = "smithay-client-toolkit", version = "0.20.0" }
smithay-client-toolkit = { git = "https://github.com/Smithay/client-toolkit" } No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

this patch needs removed

@jrmoulton
Copy link
Collaborator

I'm fine bumping the rust version

@dcz-self
Copy link
Contributor Author

dcz-self commented Feb 7, 2026

Oops, I pushed my experimental branch rather than the backported patch. I'll sort it out by tomorrow.

@dcz-self dcz-self force-pushed the actions branch 2 times, most recently from bbe123e to 22ceda9 Compare February 8, 2026 17:29
@dcz-self
Copy link
Contributor Author

dcz-self commented Feb 8, 2026

Done, and bumped the version, but clippy is unhappy now.

Should I apply the suggestions in a separate MR?

dcz-self pushed a commit to dcz-self/floem that referenced this pull request Feb 8, 2026
Needed for UTF code point navigation in lapce#1028
@dcz-self dcz-self mentioned this pull request Feb 8, 2026
dcz-self pushed a commit to dcz-self/floem that referenced this pull request Feb 8, 2026
Needed for UTF code point navigation in lapce#1028
dcz added 2 commits February 8, 2026 17:45
@dcz-self
Copy link
Contributor Author

dcz-self commented Feb 8, 2026

Well, I did it anyway in #1031

@dcz-self dcz-self requested a review from jrmoulton February 16, 2026 06:30
jrmoulton pushed a commit that referenced this pull request Feb 16, 2026
Needed for UTF code point navigation in #1028

Co-authored-by: dcz <gilapfco.dcz@porcupinefactory.org>
Copy link
Collaborator

@jrmoulton jrmoulton left a comment

Choose a reason for hiding this comment

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

Overall this looks good to me but I think there is a bug on line 305

(cursor_end.saturating_sub(maxlen), cursor_end)
} else {
let cursor_end = cursor.saturating_sub(SURROUNDING_BYTES);
(cursor_end, cmp::max(cursor_end + maxlen, text.len()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
(cursor_end, cmp::max(cursor_end + maxlen, text.len()))
(cursor_end, cmp::min(cursor_end + maxlen, text.len()))

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be min right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, nice catch. Maybe I should add some unit tests before I resubmit.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that would be great. and some docs (even if pretty minimal describing surrounding text would be great)

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