This change renames the `StatefulWidget::render` method to
`render_stateful` to avoid conflicts with the `Widget::render` method.
Often both the `Widget` and `StatefulWidget` traits are in scope, and
when calling the `render` method on a `StatefulWidget` the compiler
cannot determine which trait to use. This change resolves that issue by
renaming the `StatefulWidget::render` method to `render_stateful`.
The `StatefulWidget::render` method is still available, but it is
deprecated. A default implementation of `render_stateful` is provided
that calls the deprecated `render` method.
Callers should update their code to use `render_stateful` instead of
`render`.
implementors of the `StatefulWidget` trait should update their
implementations to implement `render_stateful` instead of `render`, and
provide an implementation of `render` that calls `render_stateful`.
This change is non-breaking. The deprecated `render` method will be
removed in a future release of Ratatui (likely 0.29.0).
Addresses part of a problem raised in
<https://github.com/ratatui-org/ratatui/issues/996>
- Rewrote the line / span rendering code to take into account how
multi-byte / wide emoji characters are truncated when rendering into
areas that cannot accommodate them in the available space
- Added comprehensive coverage over the edge cases
- Adds a benchmark to ensure perf
Fixes: https://github.com/ratatui-org/ratatui/issues/1032
Co-authored-by: EdJoPaTo <rfc-conform-git-commit-email@funny-long-domain-label-everyone-hates-as-it-is-too-long.edjopato.de>
Co-authored-by: EdJoPaTo <github@edjopato.de>
`Block::bordered()` is shorter than
`Block::new().borders(Borders::ALL)`, requires one less import
(`Borders`) and in case `Block::default()` was used before can even be
`const`.
The `vec![]` macro is highly optimized by the Rust team and shorter.
Don't do it manually.
This change is mainly cleaner code. The only production code that uses
this is `Terminal::with_options` and `Terminal::insert_before` so it's
not performance relevant on every render.
Fixes many not yet enabled lints (mostly pedantic) on everything that is
not the lib (examples, benchs, tests). Therefore, this is not containing
anything that can be a breaking change.
Lints are not enabled as that should be the job of #974. I created this
as a separate PR as its mostly independent and would only clutter up the
diff of #974 even more.
Also see
https://github.com/ratatui-org/ratatui/pull/974#discussion_r1506458743
---------
Co-authored-by: Josh McKinney <joshka@users.noreply.github.com>
Reduce benchmarks from 60 calls to 18. Now 3 different line counts
(64, 2048, 65535) * 6 different tests (new, render, scroll half / full,
wrap, wrap and scroll)
To run the benchmarks:
cargo bench
And then open the generated `target/criterion/report/index.html` in a
browser.
- add the BSD 2 clause and ISC licenses to the `cargo deny` allowed
licenses list (as a transitive dependency of the `fakeit` crate).
- remove the WTFPL license from the `cargo deny` allowed licenses list
as it is unused and causes a warning when running the check.