This patch implements FromIterator<&Style> and FromIterator<T:
Into<Style>> for Style to make it easier to programatically create
styles. Style already has a merge method, but it takes a slice instead
of an iterator.
Before commit f9c9e56518, this match
interpreted the key code 10 as the Enter key. Since it now uses the
Key::Enter variant instead, the comment explaining the magic number is
no longer needed.
Now the `OnEventView.on_pre_event_inner()` calls return
`Some(EventResult::Consumed(Some(Callback)))` instead of
`Some(EventResult::Consumed(None))`.
This follows the guidelines from documentation of methods returning a
`Callback`, which say that it should be ran on the `Cursive`.
While in this example this doesn't make a difference, the previous
version created confusion for new users who might not realize you can
pass the `Callback`s to the `Cursive` this way.
* Fix text alignment when wrapped
This changes the `LinesIterator` to return a `width` that corresponds
with the actual total length of the chunks, rather than returning the
total available width, when a line is wrapped. This effectively reverts
20cb033b8d (I am not sure why that commit
changed it).
* Add `is_wrapped` flag to `Row`
* Fix TextArea width with wrapped rows
Co-authored-by: Alexandre Bury <alexandre.bury@gmail.com>
As starting to use the cursive library I've found it challenging to
figure out how to actually use the themes. Only after checking the
source code, and another library actually using this feature, I've
managed to apply it to my project.
This change makes it easier for new commers to use toml themes by
extending the documentationn