Conversation
|
😅 I forgot cargo fmt and cargo test. |
|
Maybe I should add methods like |
cmyr
left a comment
There was a problem hiding this comment.
Cool this looks good to me, I have a few little tweaks but overall happy to take this patch! :)
druid/src/text/rich_text.rs
Outdated
| /// # use druid::text::{RichTextBuilder, Attribute}; | ||
| /// let mut rich_text = RichTextBuilder::new(); | ||
| /// rich_text.push("Hello World").underline(true); | ||
| /// let rich_text = rich_text.build(); |
There was a problem hiding this comment.
A slightly richer example:
| /// # use druid::text::{RichTextBuilder, Attribute}; | |
| /// let mut rich_text = RichTextBuilder::new(); | |
| /// rich_text.push("Hello World").underline(true); | |
| /// let rich_text = rich_text.build(); | |
| /// # use druid::text::{Attribute, RichTextBuilder}; | |
| /// # use druid::FontWeight; | |
| /// let mut builder = RichTextBuilder::new(); | |
| /// builder.push("Hello "); | |
| /// builder.push("World!").weight(FontWeight::Bold); | |
| /// let rich_text = rich_text.build(); |
druid/src/text/rich_text.rs
Outdated
| Self::default() | ||
| } | ||
|
|
||
| /// Add string to the end of text and `AttributesAdder` for the added string. |
There was a problem hiding this comment.
| /// Add string to the end of text and `AttributesAdder` for the added string. | |
| /// Append a `&str` to the end of the text. | |
| /// | |
| /// This method returns a [`AttributesAddr`] that can be used to style the newly | |
| /// added string slice. |
druid/src/text/rich_text.rs
Outdated
| /// Get the `AttributesAdder` for the range. | ||
| pub fn range(&mut self, range: Range<usize>) -> AttributesAdder { |
There was a problem hiding this comment.
I'd give this a slightly more verbose name:
| /// Get the `AttributesAdder` for the range. | |
| pub fn range(&mut self, range: Range<usize>) -> AttributesAdder { | |
| /// Get an [`AttributesAdder`] for the given range. | |
| /// | |
| /// This can be used to modify styles for a given range after it has been added. | |
| pub fn add_attributes_for_range(&mut self, range: Range<usize>) -> AttributesAdder { |
|
also changed |
|
I think squashing is a good idea 😅. Please add instructions to setup hooks on windows |
not sure what this is referring to :) |
this doesn't work for windows. |
|
@maan2003 hm I don't now much about this, but maybe search for "git hooks on windows" and see what's involved? would be happy to take a PR that updates those docs. |
I have decided to move
RichTextinto a separate module not sure if it is better to keep it insidestorage