Commit Graph

109 Commits

Author SHA1 Message Date
Arthur Sonzogni
0acfd8f255
Introduce Loop. (#476)
It can be used to give developers a better control on the loop. Users
can use it not to take full control of the thread, and poll FTXUI from
time to time as part of an external loop.

This resolves: https://github.com/ArthurSonzogni/FTXUI/issues/474
2022-10-18 21:29:27 +02:00
Arthur Sonzogni
b3ba747d82
Feature: Slider in any directions. (#468)
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.
2022-08-30 18:52:33 +02:00
Arthur Sonzogni
925a7578d4
Feature: the Modal component. (#418) 2022-06-12 17:08:22 +02:00
Arthur Sonzogni
764c24ef40
Add code coverage support. (#378) 2022-04-17 15:47:20 +02:00
Arthur Sonzogni
aebde94352
Add clang-tidy. (#368) 2022-03-31 02:17:43 +02:00
Arthur Sonzogni
548fa51b71
Upgrade version (#363) 2022-03-20 21:14:17 +01:00
Arthur Sonzogni
4da63b9260
Animation (#355) 2022-03-13 18:51:46 +01:00
Kefu Chai
95c766e9e4
Component decorators (#354)
Add decorator variants for decorator components

Add the "pipe" operator for components, similar to what was done for Elements.
We are able to put something like:
```
Button(...) | Maybe(&show_button)
```

Add decorators for:
- `Maybe`
- `CatchEvent`
- `Renderer`

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2022-03-12 15:18:36 +01:00
Arthur Sonzogni
5da7b8a59a
Fix automerge in tables. (#333) 2022-02-13 11:41:31 +01:00
Arthur Sonzogni
9c4218c2a8
Support SIGTSTP and task posting. (#331)
- Add support for SIGTSTP:
https://github.com/ArthurSonzogni/FTXUI/issues/330
This

- Add support for task posting.
This allows folks to defer function execution, and execute it directly
below the main loop. The task are executed in a FIFO order.
2022-02-13 11:11:34 +01:00
Arthur Sonzogni
81b7207121
Move to v2.0.0 (#315) 2022-01-22 17:58:33 +01:00
pezy
feb24b9498
Fix Clamp crash when entries_ size is zero (#306)
Run ftxui_example_homescreen on Windows, then select compiler tab, crash on origin code.

Co-authored-by: chenpeizhe <peizhe.chen@horizon.ai>
2022-01-13 01:46:09 +01:00
Arthur Sonzogni
fc92f52b4c
The collapsible element. (#294) 2022-01-02 15:48:56 +01:00
Arthur Sonzogni
0d47dd19ab
Feature: Canvas (#287)
Draw using braille and block characters on a grid.
2021-12-23 14:17:33 +01:00
Arthur Sonzogni
7e5cd23b4c
Add focusPosition[relative](x,y) (#280)
It allows when using inside a frame, to scroll the view toward a
particular position.

This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/125
2021-12-13 11:38:31 +01:00
Arthur Sonzogni
602392c43d
Implement flexbox (#277)
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.
2021-12-11 17:58:25 +01:00
bogdasar1985
8f405f5054
Fix a typo (#256) 2021-11-09 12:11:45 +01:00
Arthur Sonzogni
aa6b78b8ad
Upgrade version to 0.11.1 (#246)
A minor new version. Mostly for packaging the library in Release mode.
2021-10-23 21:13:23 +02:00
Arthur Sonzogni
4188ee2c04
Merge workflows. (#234)
- Merge all the workflows into one file.
- Produce Windows and MacOS artifact.
2021-10-17 20:10:07 +02:00
Arthur Sonzogni
026a005753
Table (#229)
This class allows rendering stylized table.
2021-10-15 23:04:11 +02:00
Arthur Sonzogni
57a5512a22
Support dynamic library. (#225)
- Let the global `BUILD_SHARED_LIBS` dictates whether the library should
  be built statically or dynamically. The cmake's default is statically.
- Add library version and symlink.

This lead to the following install tree.
.
├── include
│   └── ftxui
│       ├── component [...]
│       ├── dom [...]
│       ├── screen [...]
│       └── util [...]
└── lib
    ├── cmake
    │   └── ftxui
    │       ├── ftxui-config.cmake
    │       ├── ftxui-config-version.cmake
    │       └── ftxui-config-version-noconfig.cmake
    ├── ftxui-component.so -> ftxui-component.so.0.10.369
    ├── ftxui-component.so.0.10.369
    ├── ftxui-dom.so -> ftxui-dom.so.0.10.369
    ├── ftxui-dom.so.0.10.369
    ├── ftxui-screen.so -> ftxui-screen.so.0.10.369
    └── ftxui-screen.so.0.10.369

Fixed: https://github.com/ArthurSonzogni/FTXUI/issues/223
2021-10-10 12:52:34 +02:00
ArthurSonzogni
0a5e9f2a2f Add workflow creating releases. 2021-09-30 21:25:47 +02:00
Arthur Sonzogni
c5ef0c7fb5 feat: Dropdown select menu. (#214)
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
2021-09-30 20:55:47 +02:00
Arthur Sonzogni
0d1a7ffe6d
Add Changelog. (#213)
- Increase version to 0.9
- Add a changelog.

From now one. Developpement happens on the `dev` branch.

See: https://github.com/ArthurSonzogni/FTXUI/discussions/207
2021-09-26 14:48:48 +02:00
Arthur Sonzogni
51850f1189
Introduce gridbox. (#190)
Introduce gridbox.
Similar to hbox and vbox, this component combine both into a grid.
2021-08-22 19:36:11 +02:00
Arthur Sonzogni
79b8928f6e
Reland "Factorize box layout functions. (#185)"" (#187)
This reverts commit a7095970bc.
2021-08-10 22:15:24 +02:00
Arthur Sonzogni
98f49a581c
Revert "Factorize box layout functions. (#185)" (#186)
This reverts commit 71299daea4.
2021-08-10 19:36:57 +02:00
Arthur Sonzogni
71299daea4
Factorize box layout functions. (#185)
|hbox| and |vbox| are similar. They are just the same component, but
drawing in a different direction.

This patchs factorize the layout logic. Goal is to reduce code size and
reuse it for the |gridbox| dom element.

Bug: https://github.com/ArthurSonzogni/FTXUI/issues/114
2021-08-10 14:20:03 +02:00
Arthur Sonzogni
3b4ab618a3
Prefer std::string over std::wstring. (#179)
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>
2021-08-08 23:25:20 +02:00
Arthur Sonzogni
fe290e7fed
Increase version. (#146) 2021-07-11 12:25:54 +02:00
ArthurSonzogni
7f514ff41c Remove toggle.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
bead2134d6 Remove radiobox.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
d5cb4648d2 Remove menu.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
0ca7da630b Remove container.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
26db8228f9 Remove input.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
7ee6edfd1f Remove checkbox.hpp 2021-07-11 12:23:42 +02:00
ArthurSonzogni
e66ebe5443 Remove button.hpp 2021-07-11 12:23:42 +02:00
Arthur Sonzogni
81b428af5a
Implement Fallback for microsoft's terminals. (#138)
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.
2021-07-04 17:38:31 +02:00
Arthur Sonzogni
a2e7ff852e
Cleanup. (#132)
- Split the large CMakeList.
- Remove travis
- Remove gitlab-ci.yml
2021-06-26 15:14:27 +02:00
Arthur Sonzogni
93922f102f
Do not throw SIGINT after catching SIGINT signal (#128)
This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/117
2021-06-26 00:42:08 +02:00
Arthur Sonzogni
1fc86d31db
Add benchmark. (#127) 2021-06-26 00:08:21 +02:00
ArthurSonzogni
91c5954fe2 Fix component ownership.
When switching from raw pointers toward shared_ptr, the destructor
wasn't updated correctly.

This patch:
- Fixes the issue.
- Add two regression tests.
- Use address sanitizer for the tests.

This fixes: https://github.com/ArthurSonzogni/FTXUI/issues/115
2021-06-21 22:58:49 +02:00
ArthurSonzogni
986ea2b37e Add fuzzer for termin_input_parser
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
2021-06-19 11:09:52 +02:00
myd7349
3d5e4eb6ca
Set git_version when .git folder is missing (#116)
If we download the FTXUI source archive from the GitHub website, then the `.git` folder will be missing.
In such case, CMake configuration will fail:
> git found
> fatal: not a git repository (or any of the parent directories): .git
> CMake Error at CMakeLists.txt:21 (project):
>   VERSION "0.6." format invalid.
2021-06-17 12:54:26 +02:00
ArthurSonzogni
462664520a Increase version to 0.6
Two new compoents:
- CatchEvent
- ResizableSplit{Left,Top,Right,Bottom}
2021-05-28 15:07:08 +02:00
ArthurSonzogni
bba2abbb60 Introduce ResizableSplit 2021-05-28 15:07:08 +02:00
Arthur Sonzogni
aacb677e84
Introduce CatchEvent (#104) 2021-05-23 12:53:20 +02:00
Arthur Sonzogni
e520ac59f9
Switch to -Wshadow (#98) 2021-05-16 22:42:22 +02:00
Arthur Sonzogni
a574a6c3ee
Pass -Wshadow (#97)
Requested from:
https://github.com/robinlinden/hastur/pull/12
2021-05-16 17:18:11 +02:00
Arthur Sonzogni
cf4fdf257e
Build the libraries statically. (#96)
This may resolve:
https://github.com/ArthurSonzogni/FTXUI/issues/89
2021-05-16 11:59:20 +02:00