1. Stop taking Ref<XxxOption> in Component constructors. Instead, use
the XxxOption directly. Passing by copy avoid problems developers had
where one was shared in between multiple component, causing issues.
2. Add variants of most component constructors taking a struct only.
This replaces:
https://github.com/ArthurSonzogni/FTXUI/pull/670
This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/426
Based on the existing color decorators, create new ones to apply a gradient effect on the DOM.
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
Add the `SliderOption` option supporting:
```cpp
{
Ref<T> value;
ConstRef<T> min = T(0);
ConstRef<T> max = T(100);
ConstRef<T> increment = (max() - min()) / 20;
GaugeDirection direction = GaugeDirection::Right;
Color color_active = Color::White;
Color color_inactive = Color::GrayDark;
};
```
In particular, this supports multiple direction. This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/467
This one do not support adding a label. The old constructors can still
be used to have a label.
- Fix focus in flexbox. This required resetting the focus state at the
beginning of the ComputeRequirement(), because it can now run several
times.
This resolves:https://github.com/ArthurSonzogni/FTXUI/issues/399
- Add Box::Union.
- Add a preliminary implementation of forwarding selected_box from
within the flexbox.
Add the `automerge` attribute to the Pixel bit field. It controls
whether two pixels must be automerged. Defining this allows two
mergeable characters not to be merged.
This was requested by:
https://github.com/ArthurSonzogni/FTXUI/issues/285
Use std::string by default for the implementation of FTXUI's input
component.
Along the way:
- Give a correct implementation for fullwidth characters.
- Add tests
- Modify the way the cursor is drawn.
This implement the flexbox elements, following the HTML one.
Built from them, there is also the following elements:
- `paragraph`
- `paragraphAlignLeft`
- `paragraphAlignRight`
- `paragraphAlignCenter`
- `paragraphAlignJustify`
This is a breaking change.
In case of embedded systems, the terminal size may not
always be detectable (e.g. in case of serial output).
Allow application to set up the default size in case
autodetection fails. On platform such as Emscripten,
there is only "fallback" size.
Signed-off-by: Jarosław Pelczar <jarek@jpelczar.com>
In the past, FTXUI switched from std::string to std::wstring to support
fullwidth characters. The reasons was that fullwidth characters can be
stored inside a single wchar_t.
Then FTXUI added support for combining characters. A single glygh
doesn't even fit a wchar_t. Instead, a glyph can be arbitrary large.
The usage of wstring doesn't really fit the new model and have several
drawbacks:
1. It doesn't simplify the implementation of FTXUI, because of combining
characters.
2. It reduces drawing performance by 2x.
3. It increase Screen's memory allocation by 2x.
This patch converts FTXUI to use std::string internally. It now exposes
std::string based API. The std::wstring API remains, but is now
deprecated.
Tests and examples haven't been update to show the breakage is limited.
They will be updated in a second set of patches.
Bug: https://github.com/ArthurSonzogni/FTXUI/issues/153
Co-authored-by: Tushar Maheshwari <tushar27192@gmail.com>
- Convert Dimension to namespace to allow defining Fit method from dom.
- Use Dimensions extracted from Terminal as replacement struct.
- Convert Terminal to namespace as it only defines static members.
- Remove dom references from screen library (circular dependency).
From CppCoreGuidelines:
Rule of Zero: C.20: If you can avoid defining default operations, do.
C.52: Use inheriting constructors to import constructors into a derived class that does not need further explicit initialization.
DRY forward and using declarations.
Miscellaneous:
Fix format.sh to output examples with normalised paths in sorted order.
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
Modify the ftxui::Pixel. Instead of storing a wchar, store a
std::wstring. Now a single pixel can store multiple codepoints.
If a codepoint is of size <=0, it will be appended to the previous
pixel.
Only ftxui::text() is supported. ftxui::vtext support still needs to be
added.
This causes the following CPU and memory regression:
- Memory: Pixel size increases by 200% (16 byte => 48byte).
- CPU: Draw/Second decrease by 62.5% (16k draw/s => 6k draw/s on 80x80)
Both regressions are acceptable. There are still two orders of magnitude
(100x) before the levels where performance/memory concerns begins.
This fixes: https://github.com/ArthurSonzogni/FTXUI/issues/109
wingdi.h (included via Windows.h) defines an RGB macro that breaks
things. If a user really wants that macro in the same file as FTXUI they
can move the Windows.h include to after the inclusion of FTXUI's
headers.
FTXUI supported only the 16 colors palette.
This patch adds support for the 256 palette and the TrueColor(8×8×8)
mode.
This was made by kerdelos@ and fixes issue:
https://github.com/ArthurSonzogni/FTXUI/issues/45
Co-authored-by: Damien D <kerdelos@gmail.com>
Co-authored-by: Arthur Sonzogni <sonzogniarthur@gmail.com>