Rename SpannedString::shrink_to_fit -> trim

This commit is contained in:
Alexandre Bury 2020-10-15 17:38:13 -07:00
parent 382557f713
commit 58bbae5ec8
2 changed files with 28 additions and 2 deletions

View File

@ -1,21 +1,47 @@
# Changelog # Changelog
## Next version (cursive-core 0.1.2, cursive 0.15.1) ## Next version (cursive-core 0.2.0, cursive 0.16)
### Breaking Changes
- Backends are now initialized when starting the event loop rather than when creating Cursive.
- As a result initialization and runner functions have changed.
### API updates ### API updates
- Add `ProgressBar::set_{min,max,range,counter,label}` for non-chained API. - Add `ProgressBar::set_{min,max,range,counter,label}` for non-chained API.
- Derive Clone, Copy, Debug, PartialEq, Hash for more types. - Derive Clone, Copy, Debug, PartialEq, Hash for more types.
- Add backend initializers using other files than /dev/tty for ncurses and termion. - Add backend initializers using other files than /dev/tty for ncurses and termion.
- Add `CursiveRunner` to handle an event loop.
- `XY<T>` now implements `Default` for `T: Default`.
- `Style` now implements `FromIterator<&Style>` to merge multiple styles.
- `XY::stack_{horizontal,vertical}` are now `must_use`.
- `SpannedString` now implements `FromIterator<SpannedString>`.
- `view::ScrollBase` is now deprecated in favor of the `view::scroll` module.
- Add `Finder::call_on_all` and `Cursive::call_on_all_named` to call the same closure of
several views with the same type and name.
- Add `SpannedString::remove_spans` to remove spans from a StyledString.
- Add `SpannedString::compact` to compact the source to only include span content.
- Add `SpannedString::trim(_{start, end})` to remove the unused prefix, suffix or both of the source.
- Add `SpannedString::spans(_raw)_attr_mut` to give mutable access to the attribute of the spans.
- Add `TextContent::with_content` to give mutable access to the `StyledString` of a `TextView`.
### Improvements ### Improvements
- `ListView` now supports children taller than 1 row. - `ListView` now supports children taller than 1 row.
- Added an `autocomplete` example.
- Added a `stopwatch` example.
### Bugfixes ### Bugfixes
- Fix scroll module when inner view size is close to available size. - Fix scroll module when inner view size is close to available size.
- Fix text alignment for wrapped lines. - Fix text alignment for wrapped lines.
- Fix focus change with ScrollView.
- Fix possible crash with the BearLibTerminal backend.
- Dispatch `call_on_*` methods to all screens.
- Fix potential issue with `setlocale` in ncurses backend on BSD.
- Fix handling of multi-bytes newlines characters.
- Fix
### Doc ### Doc

View File

@ -235,7 +235,7 @@ impl<T> SpannedString<T> {
} }
/// Shrink the source to discard any unused prefix or suffix. /// Shrink the source to discard any unused prefix or suffix.
pub fn shrink_to_fit(&mut self) { pub fn trim(&mut self) {
self.trim_end(); self.trim_end();
self.trim_start(); self.trim_start();
} }