-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
In AttributedString::set_text_color and AttributedString::set_font, range.end is used as the length field to CFRange::init, which unless I am mistaken seems wrong to me.
The documentation implies that if I set the set range 3..4 to red, I would change only character 3 to be red, not 3 through 6, which is what currently happens.
The relevant code is here:
cacao/src/text/attributed_string.rs
Lines 45 to 58 in 7ffe398
| /// Sets the text (foreground) color for the specified range. | |
| pub fn set_text_color<C: AsRef<Color>>(&mut self, color: C, range: Range<isize>) { | |
| let color: id = color.as_ref().into(); | |
| let range = CFRange::init(range.start, range.end); | |
| unsafe { | |
| let _: () = msg_send![ | |
| &*self.0, | |
| addAttribute: NSForegroundColorAttributeName, | |
| value: color, | |
| range: range, | |
| ]; | |
| } | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels