Closed felinira closed 2 weeks ago
I don't have the time to review this right now but two questions:
is it important for you to have this in the next release or waiting till a future .x would be okay?
We can postpone it for now.
do you think you could add an example of how it could be used?
Sure, that makes sense. It's quite an involved interface.
There is still one thing here that I don't particularly understand: The 'bytes' return value is supposed to be a glib::Bytes
that sometimes contains '\0' bytes and sometimes it doesn't. calling contents()
on gtk::TextView
will return a \0 byte, but it won't with contents_at()
.
Maybe two wrapper objects for (range, attr, value) triples wouldn't be such a bad idea. When writing the example it was very cumbersome to change attributes, adding attributes by constants, etc.
Maybe two wrapper objects for (range, attr, value) triples wouldn't be such a bad idea. When writing the example it was very cumbersome to change attributes, adding attributes by constants, etc.
I think we can do that as a second step :) but yes, having to deal with constants is not ideal. But also not sure how we can do something that wouldn't be too far away from the original API.
Maybe we can make those attributes an enum? then you would only have a Vec<(Range, TextAttribute)>
I am a little unsure if it's ever ok to return null in get_contents(_at) or not. Should I return an empty gbytes instead?