Repository navigation
feat: Implement display for text selection and caret - #35830
Conversation
2025-03-08.1.01.52.movImplemented proper caret display during selection: Previously the caret is give by selection range as well, which contains no information on where the selection started. |
3aea509 to
2514676
Compare
1aed607 to
6dfe6ae
Compare
2025-03-08.8.09.24.movSwitch to using |
|
That's amazing, i couldn't figure out how to do that. |
d7b965c to
40e5d1c
Compare
40e5d1c to
61f6847
Compare
Huh I have no idea why this is happening with this lint error |
|
I’ll wait for #35906 to be merged then rebase this |
6ce0c7b to
56d7018
Compare
|
@mrobinson I've made changes and just to recap there are some remaining issues that requires your input:
Well, actually, I guess I'll just strip them out as well.
I guess I can make it directional without problem now that old layout is being removed in: |
|
🔨 Triggering try run (#14378847958) for Linux (WPT) |
|
Test results for linux-wpt from try job (#14378847958): Flaky unexpected result (28)
Stable unexpected results that are known to be intermittent (18)
Stable unexpected results (2)
|
|
|
|
Test results for linux-wpt from try job (#14378847958): Flaky unexpected result (1)
Stable unexpected results that are known to be intermittent (2)
Stable unexpected results (1)
|
|
|
hold up @jdm the WPT test failed. Did a quick check the failing test is How do we proceed with fixing this? From what I can tell I don't think the ref shouldn't be focused? Edit: weirdly enough I've tested WPT beforehand (weeks ago when the PR is first readied to be reviewed) and it actually passed this test . |
|
@dklassic I think it's because the test set caret color to be transparent? |
I think you're right, currently the color is directly derived by |
|
After looking into a bit, I think it's okay to make the regression. The fragment doesn't seem to contain information about |
Signed-off-by: DK Liao <[email protected]>
49742e7 to
536d214
Compare
|
🔨 Triggering try run (#14381508523) for Linux (WPT) |
|
Test results for linux-wpt from try job (#14381508523): Flaky unexpected result (20)
Stable unexpected results that are known to be intermittent (21)
Stable unexpected results (1)
|
|
|
|
🔨 Triggering try run (#14382164587) for Linux (WPT) |
|
Test results for linux-wpt from try job (#14382164587): Flaky unexpected result (19)
Stable unexpected results that are known to be intermittent (19)
|
|
✨ Try run (#14382164587) succeeded. |
This PR introduces an initial, straightforward implementation for displaying text selection and the caret.
This is achieved by passing the selection range and insertion point index down to
TextFragment, along with the starting offset of eachTextFragmentto determine the proper range for displaying the caret and text selection. Additionally, theselected_stylewas passed intoTextFragmentto specify the background color.During the final build phase, although whitespace is typically ignored when constructing glyphs, we still need to retrieve it to render both the caret and text selection at the correct location. This ensures that whitespace is not overlooked when the
TextFragmentcontains an insertion point or selection range.There are several improvements yet to be made, including:
Working Examples
macOS
2025-03-07.11.11.58.mov
Windows
20250306-1753-42.2758224.mp4
Linux
Screencast.from.03-07-2025.11_05_41.AM.webm
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors