Commit 36f571b
committed
fix: return string Content from FmScriptCompletionData
The cached TextBlock introduced in f37e5a5 violates Avalonia's
single-parent rule when AvaloniaEdit's CompletionList reuses the
item across multiple ContentPresenter instances — produced an
InvalidOperationException ('already has a visual parent
ContentPresenter') the moment the completion window opened.
Return the bare Text string instead. ContentPresenter wraps it in
its own TextBlock automatically and owns that wrapper exclusively,
so reuse across virtualised rows is safe. Drops one allocation per
Content access compared to the original 'new TextBlock { Text = .. }'
factory pattern.1 parent adbd7aa commit 36f571b
1 file changed
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| |||
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
20 | | - | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
| |||
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 27 | | |
37 | 28 | | |
38 | 29 | | |
39 | 30 | | |
40 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
41 | 36 | | |
42 | 37 | | |
43 | 38 | | |
| |||
0 commit comments