Skip to content

Handle replacementRange in AvnView - #21608

Merged
MrJul merged 3 commits into
AvaloniaUI:masterfrom
MrJul:fix/macos-selection-range
Jun 21, 2026
Merged

Handle replacementRange in AvnView#21608
MrJul merged 3 commits into
AvaloniaUI:masterfrom
MrJul:fix/macos-selection-range

Conversation

@MrJul

@MrJul MrJul commented Jun 17, 2026

Copy link
Copy Markdown
Member

What does the pull request do?

This PR started as an investigation into a problem that remained in #21569.
It uncovered several issues, now fixed:

  • Avalonia didn't always send selection changes, causing replacementRange to lag behind, in both setMarkedText and insertText.
  • replacementRange wasn't handled in setMarkedText, causing duplicate characters.
  • replacementRange wasn't handled in insertText, causing duplicate characters. This is what fix duplicates in MacOS special character inputs #21569 did, but we now don't need any special casing since replacementRange is correct.
  • Out-of-bounds ranges weren't handled in attributedSubstringForProposedRange, triggering an assertion failure (visible in debug mode).

The "accent menu" (visible by holding a key) now works properly.
IMEs have been re-tested.

@MrJul MrJul added bug os-macos backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels Jun 17, 2026
@MrJul MrJul added the customer-priority Issue reported by a customer with a support agreement. label Jun 17, 2026
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.1.999-cibuild0066608-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added the backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch label Jun 18, 2026

@Gillibald Gillibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@MrJul
MrJul added this pull request to the merge queue Jun 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 19, 2026
@MrJul
MrJul added this pull request to the merge queue Jun 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 20, 2026
@MrJul
MrJul added this pull request to the merge queue Jun 21, 2026
Merged via the queue into AvaloniaUI:master with commit b3014cc Jun 21, 2026
12 checks passed
@MrJul
MrJul deleted the fix/macos-selection-range branch June 21, 2026 09:44
MrJul added a commit that referenced this pull request Jun 23, 2026
* macOS: ensure native selectedRange is up-to-date

* macOS: handle replacementRange in setMarkedText and insertText

* macOS: handle unexpected ranges in attributedSubstringForProposedRange
@MrJul MrJul added backported-11.3.x and removed backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch labels Jun 23, 2026
MrJul added a commit to MrJul/Avalonia that referenced this pull request Jun 23, 2026
* macOS: ensure native selectedRange is up-to-date

* macOS: handle replacementRange in setMarkedText and insertText

* macOS: handle unexpected ranges in attributedSubstringForProposedRange
@MrJul MrJul added backported-12.0.x and removed backport-candidate-12.0.x Consider this PR for backporting to 12.0 branch labels Jun 23, 2026
github-actions Bot pushed a commit to Stella-sea/ryujinx-admin that referenced this pull request Jun 26, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [Avalonia](https://avaloniaui.net/?utm_source=nuget&utm_medium=referral&utm_content=project_homepage_link) ([source](https://github.com/AvaloniaUI/Avalonia)) | `11.3.17` → `11.3.18` | ![age](https://developer.mend.io/api/mc/badges/age/nuget/Avalonia/11.3.18?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Avalonia/11.3.17/11.3.18?slim=true) |
| [Avalonia.Desktop](https://avaloniaui.net/?utm_source=nuget&utm_medium=referral&utm_content=project_homepage_link) ([source](https://github.com/AvaloniaUI/Avalonia)) | `11.3.17` → `11.3.18` | ![age](https://developer.mend.io/api/mc/badges/age/nuget/Avalonia.Desktop/11.3.18?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Avalonia.Desktop/11.3.17/11.3.18?slim=true) |
| [Avalonia.Diagnostics](https://avaloniaui.net/?utm_source=nuget&utm_medium=referral&utm_content=project_homepage_link) ([source](https://github.com/AvaloniaUI/Avalonia)) | `11.3.17` → `11.3.18` | ![age](https://developer.mend.io/api/mc/badges/age/nuget/Avalonia.Diagnostics/11.3.18?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Avalonia.Diagnostics/11.3.17/11.3.18?slim=true) |
| [Avalonia.Markup.Xaml.Loader](https://avaloniaui.net/?utm_source=nuget&utm_medium=referral&utm_content=project_homepage_link) ([source](https://github.com/AvaloniaUI/Avalonia)) | `11.3.17` → `11.3.18` | ![age](https://developer.mend.io/api/mc/badges/age/nuget/Avalonia.Markup.Xaml.Loader/11.3.18?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/Avalonia.Markup.Xaml.Loader/11.3.17/11.3.18?slim=true) |

---

### Release Notes

<details>
<summary>AvaloniaUI/Avalonia (Avalonia)</summary>

### [`v11.3.18`](https://github.com/AvaloniaUI/Avalonia/releases/tag/11.3.18)

[Compare Source](AvaloniaUI/Avalonia@11.3.17...11.3.18)

##### What's Changed

##### Enhancements

- XAML – Enhance Roslyn-compiler visible metadata by [@&#8203;maxkatz6](https://github.com/maxkatz6) in [#&#8203;21546](AvaloniaUI/Avalonia#21546)

##### Fixes

- Core – Fix StackOverflow when a `NaN` offset is set on `ScrollViewer` by [@&#8203;NicholasLachapelle](https://github.com/NicholasLachapelle) in [#&#8203;21558](AvaloniaUI/Avalonia#21558)
- macOS – Handle `replacementRange` in `AvnView` by [@&#8203;MrJul](https://github.com/MrJul) in [#&#8203;21608](AvaloniaUI/Avalonia#21608)

**Full Changelog**: <AvaloniaUI/Avalonia@11.3.17...11.3.18>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNzguMCIsInVwZGF0ZWRJblZlciI6IjQzLjE3OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported-11.3.x backported-12.0.x bug customer-priority Issue reported by a customer with a support agreement. os-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants