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>
Dom
- `vscroll_indicator`. Show a scrollback indicator on the right.
Component
- `Maybe`: Display an component conditionnally based on a boolean.
- `Dropdown`: A dropdown select list.
This address:
https://github.com/ArthurSonzogni/FTXUI/issues/204
- Password is now taking a ref, allowing a shared state to be used by
multiple passwords.
- Password cursor position is now optional. It will be used only when
set to something different from -1.
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).
- Invoke DetachAllChildren from ~ComponentBase
- Define Focused using Active
- Compact TakeFocus loop code
- const-correctness for Parent, Active and Focused
* Reorganize ContainerBase
- Reduce Container overloads using default arguments
- Extract member function pointers to virtual functions
- Separate classes for Vertical, Horizontal and Tab containers
* Collect unpack from NodeDecorator subclasses
* Reduce redundant expansion for aliases
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>
Allows components to remove a child or access to children in general.
Co-authored-by: Felix Heitmann <fheitmann@se-gpu-03.intern.plath.de>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
I finally got access to a computer using the Microsoft's Windows OS.
That's the opportunity to find and mitigate all the problems
encountered. This patch:
1. Introduce an option and a C++ definition to enable fallback for
Microsoft's terminal emulators. This allows me to see/test the
Microsoft output from Linux. This also allows Windows users to remove
the fallback and target non Microsoft terminals on Windows if needed.
2. Microsoft's terminal suffer from a race condition bug when reporting
the cursor position:
https://github.com/microsoft/terminal/pull/7583.
The mitigation is not to ask for the cursor position in fullscreen
mode where it isn't really needed and request it less often.
This fixes: https://github.com/ArthurSonzogni/FTXUI/issues/136
3. Microsoft's terminal do not handle properly hidding the cursor. Instead
the character under the cursor is hidden, which is a big problem. As
a result, we don't enable setting the cursor to the best position for
[input method editors](https://en.wikipedia.org/wiki/Input_method),
It will be displayed at the bottom right corner.
See:
- https://github.com/microsoft/terminal/issues/1203
- https://github.com/microsoft/terminal/issues/3093
4. Microsoft's terminals do not provide a way to query if they support
colors. As a fallback, assume true colors is supported.
See issue:
- https://github.com/microsoft/terminal/issues/1040
This mitigates:
- https://github.com/ArthurSonzogni/FTXUI/issues/135
5. The "cmd" on Windows do not properly report its dimension. Powershell
works correctly. As a fallback, use a 80x80 size instead of 0x0.
6. There are several dom elements and component displayed incorrectly,
because the font used is missing several unicode glyph. Use
alternatives or less detailled one as a fallback.
Allow Container::Vertical and Container::Horizontal to have an
external selector, similar to Container::Tab.
This is useful for implementing a menu of menu.
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
Current state: the fuzzer find interesting input immediately...
```
terminate called after throwing an instance of 'std::range_error'
what(): wstring_convert::from_bytes
```
See: https://github.com/ArthurSonzogni/FTXUI/issues/118