Commit Graph

17 Commits

Author SHA1 Message Date
Alexandre Bury
31b8e1f515 Reformat & fix clippy 2020-12-01 12:23:29 -08:00
Tejun Heo
529aff0f23
Make SpannedString iterators double ended & exact sized (#524)
So that users can, for example, do .spans().len() to determine the number of
spans.
2020-11-26 13:38:27 -08:00
Alexandre Bury
58bbae5ec8 Rename SpannedString::shrink_to_fit -> trim 2020-10-15 17:38:13 -07:00
Alexandre Bury
382557f713 Add mutable attribute access to SpannedStrings 2020-10-15 17:22:44 -07:00
Alexandre Bury
b03eafaabb Add methods to remove from a SpannedString and shrink it 2020-10-15 16:11:29 -07:00
Robin Krahl
28c64958ca
Implement FromIterator for SpannedString (#512)
This patch implements FromIterator<SpannedString<T>> for
SpannedString<T> to make it easier to create strings programatically.
We could also use fold directly without extracting the first element,
but that would require an additional allocation.
2020-10-07 10:55:12 -07:00
Alexandre Bury
e7a813b383 Fix chunk_iterator with empty spans after hard-stop 2020-08-26 16:44:56 -07:00
Alexandre Bury
b5651e3ac4 Add test for empty span after hard-stop 2020-08-26 16:44:41 -07:00
Alexandre Bury
7e32e0649e Fix handling of multi-bytes newlines 2020-08-26 15:19:51 -07:00
Alexandre Bury
f13914a272 Add test 2020-08-26 15:19:40 -07:00
Alexandre Bury
2cd6d7a80c Make backends pausable 2020-08-04 23:24:11 -07:00
James Tai
bc49eebeb8
Fix text alignment when wrapped (#471)
* 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>
2020-07-25 16:51:33 -07:00
Alexandre Bury
d31d0d0d76 Derive more stuff 2020-07-13 12:54:03 -07:00
Alexandre Bury
9bc1cd04c3 Add ScrollView::on_scroll 2020-06-30 23:22:44 -07:00
Alexandre Bury
e3a266aa0e Add once1! macro 2020-06-14 22:51:57 -07:00
Alexandre Bury
0a14106127 Fix doc links accross re-use 2020-05-26 11:01:28 -07:00
Alexandre Bury
4154f99b44 Split non-backend code into cursive-core 2020-04-23 13:46:00 -07:00