Commit Graph

522 Commits

Author SHA1 Message Date
Tushar Maheshwari
21d746e858
Remove explicit default destructors (#157)
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>
2021-07-17 12:02:08 +02:00
Arthur Sonzogni
b3a333b417
Add support for password for input element. (#158)
This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/139

CC:@Creapermann
2021-07-17 10:36:50 +02:00
Tushar Maheshwari
5ee4ec40de
Update CMake usage to enable C++17 (#156)
The target_compile_features command allows setting PUBLIC compile features for the library, making it implicit for the applications linking it. This reduces the CMake boilerplate required to set up a dependent project (eg. ftxui-starter).
2021-07-17 09:16:02 +02:00
Arthur Sonzogni
a56bb50807
Fix compilation errors. (#155) 2021-07-15 22:45:10 +02:00
Felix Heitmann
c34494ce26
Allows components to remove a child or access to children in general (#152)
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>
2021-07-15 15:29:33 +02:00
cmorganBE
23789c2d7b
Component example showing composition of components (#150)
This approach can allow for UI sections that are more modular and reusable
2021-07-14 15:04:12 +02:00
Arthur Sonzogni
9b7ddb1130
Resolve compile error on cygwin. (#151)
This should solve issue:
https://github.com/ArthurSonzogni/FTXUI/issues/149
2021-07-14 14:41:31 +02:00
Arthur Sonzogni
e87ff7e873
Minor update of the documentation. (#148) 2021-07-12 23:22:15 +02:00
cmorganBE
cd828bf94d
mainpage.md - Document 'refreshing / invalidating the screen to cause… (#147)
Add a section explaining the use for ScreenInteractive::PostEvent.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
2021-07-12 23:15:44 +02:00
Arthur Sonzogni
fe290e7fed
Increase version. (#146) 2021-07-11 12:25:54 +02:00
ArthurSonzogni
9820832fea Improve the documentation. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
5c4cd1add1 Execute IWYU 2021-07-11 12:23:42 +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
ArthurSonzogni
f53dc139e9 Add documentation for options. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
fac373494d Add option for Toggle. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
ae6473363d Add option for radiobox 2021-07-11 12:23:42 +02:00
ArthurSonzogni
33b3d1c7ab Add option for input. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
2b7daf061f Add options for checkbox. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
359100ca73 Add option for Button. 2021-07-11 12:23:42 +02:00
ArthurSonzogni
cd84b187b3 Introduce Options and use them for Menu.
Introduce Options for components. This allows me to add new features,
without updating functions signatures.
2021-07-11 12:23:42 +02:00
Arthur Sonzogni
82adc3b410
Rename library for vcpkg. (#140)
Instead of putting the archive as:
- <lib_dir>/ftxui/libcomponent.a
- <lib_dir>/ftxui/libdom.a
- <lib_dir>/ftxui/libscreen.a

Use:
- <lib_dir>/libftxui-component.a
- <lib_dir>/libftxui-dom.a
- <lib_dir>/libftxui-screen.a

This fixes an issue users have with VCPKG.

See:
https://github.com/microsoft/vcpkg/issues/16327#issuecomment-868942370
2021-07-06 02:10:35 +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
Shreyas Atre
bd21cac2b6
Menu of components (#131)
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>
2021-06-27 17:53:17 +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
2ea480f4f6
Update example homescreen. Wait for the thread to join. (#129) 2021-06-26 01:37:18 +02:00
Arthur Sonzogni
8e98928c0c
Support combining characters. (#121)
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
2021-06-26 01:32: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
Arthur Sonzogni
ba5826eab7
Fix bug with std::raise(0) (#124)
A bug has been introduced in:
478d7e8bca

I purposefully allowed raising the signal zero, because I thought this
was doing nothing. See the response:
https://stackoverflow.com/a/32260528/5112390

but this is different on Windows.

See:
https://github.com/ArthurSonzogni/FTXUI/issues/117
2021-06-22 09:43:15 +02:00
ArthurSonzogni
20a05e99ca Execute IWYU and format. 2021-06-21 23:10:51 +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
478d7e8bca On SIGINT, raise signal again.
When SIGINT is intercepted, quit the run loop and raise the signal
again.

I am not sure this addresses:
https://github.com/ArthurSonzogni/FTXUI/issues/117
Maybe?
2021-06-19 18:57:48 +02:00
ArthurSonzogni
18d1b04b7a terminal_input_parser: validate UTF8.
Make sure code points parsed are always valid UTF8. Don't assume stdin
is filled with valid data. Check for overlong UTF8 and add some tests.

The fuzzer has reached the following coverage:
- cov    : 204
- ft     : 754
- corp   : 62/12257b
- lim    : 2798
- exec/s : 1748
- rss    : 445Mb
- L      : 155/1946
- MS     : 3

Fixed:https://github.com/ArthurSonzogni/FTXUI/issues/118
2021-06-19 11:09:52 +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
Arthur Sonzogni
2406e20f36
Update README.md 2021-06-16 11:08:30 +02:00
Arthur Sonzogni
be8e09feea
Update README.md 2021-06-13 23:04:32 +02:00
ArthurSonzogni
7ca4f9bbe3 Add informations about external packages. 2021-06-13 23:03:12 +02:00
Arthur Sonzogni
6f87740801 Compatify the Screen memory.
Instead of storing all the booleans with 5 bytes, use a bit field.
The size of a Pixel has been reduced by 25%, from 20 byte to 15 bytes.
2021-06-12 21:45:55 +02:00
Arthur Sonzogni
4d29dccb06
Update README.md
Add a note about:
https://github.com/ArthurSonzogni/FTXUI/issues/109
2021-06-10 08:45:39 +02:00
Nathan Lanza
e9eab32b2f Fix compiler output argument in homescreen 2021-06-07 10:11:32 +02:00
Nathan Lanza
a24abdae19 Include utility header in autoreset.hpp for std::move 2021-06-07 10:10:34 +02:00
ArthurSonzogni
2445dc03d3 Add "long" to slider. 2021-06-02 21:13:23 +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