ratatui/examples/demo
Josh McKinney 728f82c084
refactor(text): replace Spans with Line (#178)
* refactor: add Line type to replace Spans

`Line` is a significantly better name over `Spans` as the plural causes
confusion and the type really is a representation of a line of text made
up of spans.

This is a backwards compatible version of the approach from
https://github.com/tui-rs-revival/ratatui/pull/175

There is a significant amount of code that uses the Spans type and
methods, so instead of just renaming it, we add a new type and replace
parameters that accepts a `Spans` with a parameter that accepts
`Into<Line>`.

Note that the examples have been intentionally left using `Spans` in
this commit to demonstrate the compiler warnings that will be emitted in
existing code.

Implementation notes:
- moves the Spans code to text::spans and publicly reexports on the text
module. This makes the test in that module only relevant to the Spans
type.
- adds a line module with a copy of the code and tests from Spans with a
single addition: `impl<'a> From<Spans<'a>> for Line<'a>`
- adds tests for `Spans` (created and checked before refactoring)
- adds the same tests for `Line`
- updates all widget methods that accept and store Spans to instead
store `Line` and accept `Into<Line>`

* refactor: move text::Masked to text::masked::Masked

Re-exports the Masked type at text::Masked

* refactor: replace Spans with Line in tests/examples/docs
2023-05-18 20:21:43 +02:00
..
app.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
crossterm.rs fix(examples): update input in examples to only use press events (#129) 2023-04-13 22:21:35 +02:00
main.rs feat(backend): add termwiz backend and example (#5) 2023-05-12 17:58:01 +02:00
termion.rs chore(cargo): update project metadata (#94) 2023-03-17 17:03:49 +01:00
termwiz.rs feat(backend): add termwiz backend and example (#5) 2023-05-12 17:58:01 +02:00
ui.rs refactor(text): replace Spans with Line (#178) 2023-05-18 20:21:43 +02:00