diff options
author | DK Liao <dklassic@gmail.com> | 2025-04-10 23:40:38 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-10 14:40:38 +0000 |
commit | e62aecb1037e36d9e222471f552cb07a0d78cc4b (patch) | |
tree | ccd1ebbe0ff15355ebfbddbc9719395f8759891a /components/hyper_serde/README.md | |
parent | e6595619e1c40be85b507f75bd5bed4a695732f7 (diff) | |
download | servo-e62aecb1037e36d9e222471f552cb07a0d78cc4b.tar.gz servo-e62aecb1037e36d9e222471f552cb07a0d78cc4b.zip |
feat: Implement display for text selection and caret (#35830)
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 each
`TextFragment` to determine the proper range for displaying the caret
and text selection. Additionally, the `selected_style` was passed into
`TextFragment` to 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 `TextFragment` contains an
insertion point or selection range.
There are several improvements yet to be made, including:
- The caret is static and does not flash.
- The caret is not rendered when the input field is empty. (I suppose
there should be an easy fix somewhere but I haven't found it yet)
**Working Examples**
macOS
https://github.com/user-attachments/assets/f3622cbe-9fa6-40c0-b2d8-b3a8f9842c28
Windows
https://github.com/user-attachments/assets/9b008a0d-0011-4c76-a2e2-0e35869a216c
Linux
[Screencast from 03-07-2025 11_05_41
AM.webm](https://github.com/user-attachments/assets/09a311ad-f975-4450-a66c-b20be525a5ed)
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix part of #33237 (But the cursor isn't blinking
yet)
- [x] These changes do not require tests because there's no behavior
change
Signed-off-by: DK Liao <dklassic@gmail.com>
Diffstat (limited to 'components/hyper_serde/README.md')
0 files changed, 0 insertions, 0 deletions