mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-12-16 01:48:56 +08:00
Compare commits
1 Commits
f128c442cc
...
failed-v6.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd251a6463 |
3
.bazelrc
3
.bazelrc
@@ -1,3 +0,0 @@
|
|||||||
build --cxxopt=-std=c++20
|
|
||||||
build --cxxopt=-Wall
|
|
||||||
build --cxxopt=-Werror
|
|
||||||
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@@ -104,7 +104,7 @@ jobs:
|
|||||||
--gcov-executable '${{ matrix.gcov_executable }}';
|
--gcov-executable '${{ matrix.gcov_executable }}';
|
||||||
|
|
||||||
- name: Windows - Test and coverage
|
- name: Windows - Test and coverage
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows' && false
|
||||||
working-directory: ./build
|
working-directory: ./build
|
||||||
run: >
|
run: >
|
||||||
OpenCppCoverage.exe
|
OpenCppCoverage.exe
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -20,10 +20,6 @@ out/
|
|||||||
!flake.nix
|
!flake.nix
|
||||||
!ftxui.pc.in
|
!ftxui.pc.in
|
||||||
!iwyu.imp
|
!iwyu.imp
|
||||||
!WORKSPACE
|
|
||||||
!BUILD.bazel
|
|
||||||
!MODULE.bazel
|
|
||||||
!.bazelrc
|
|
||||||
|
|
||||||
# .github directory:
|
# .github directory:
|
||||||
!.github/**/*.yaml
|
!.github/**/*.yaml
|
||||||
|
|||||||
258
BUILD.bazel
258
BUILD.bazel
@@ -1,258 +0,0 @@
|
|||||||
load(
|
|
||||||
"@rules_cc//cc:defs.bzl",
|
|
||||||
"cc_library",
|
|
||||||
"cc_test",
|
|
||||||
"cc_binary",
|
|
||||||
)
|
|
||||||
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
|
||||||
|
|
||||||
cc_library(
|
|
||||||
name = "screen",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/screen/box.cpp",
|
|
||||||
"src/ftxui/screen/color.cpp",
|
|
||||||
"src/ftxui/screen/color_info.cpp",
|
|
||||||
"src/ftxui/screen/image.cpp",
|
|
||||||
"src/ftxui/screen/screen.cpp",
|
|
||||||
"src/ftxui/screen/string.cpp",
|
|
||||||
"src/ftxui/screen/string_internal.hpp",
|
|
||||||
"src/ftxui/screen/terminal.cpp",
|
|
||||||
"src/ftxui/screen/util.hpp",
|
|
||||||
],
|
|
||||||
hdrs = [
|
|
||||||
"include/ftxui/screen/box.hpp",
|
|
||||||
"include/ftxui/screen/color.hpp",
|
|
||||||
"include/ftxui/screen/color_info.hpp",
|
|
||||||
"include/ftxui/screen/deprecated.hpp",
|
|
||||||
"include/ftxui/screen/image.hpp",
|
|
||||||
"include/ftxui/screen/pixel.hpp",
|
|
||||||
"include/ftxui/screen/screen.hpp",
|
|
||||||
"include/ftxui/screen/string.hpp",
|
|
||||||
"include/ftxui/screen/terminal.hpp",
|
|
||||||
"include/ftxui/util/autoreset.hpp",
|
|
||||||
"include/ftxui/util/ref.hpp",
|
|
||||||
],
|
|
||||||
includes = ["include", "src"],
|
|
||||||
strip_include_prefix = "",
|
|
||||||
copts = ["-std=c++17"],
|
|
||||||
)
|
|
||||||
|
|
||||||
cc_test(
|
|
||||||
name = "screen_test",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/screen/string_test.cpp",
|
|
||||||
"src/ftxui/screen/color_test.cpp",
|
|
||||||
],
|
|
||||||
deps = [
|
|
||||||
"//:screen",
|
|
||||||
"@googletest//:gtest_main",
|
|
||||||
],
|
|
||||||
includes = ["include", "src"],
|
|
||||||
copts = ["-std=c++20"],
|
|
||||||
testonly = True,
|
|
||||||
)
|
|
||||||
|
|
||||||
cc_library(
|
|
||||||
name = "dom",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/dom/automerge.cpp",
|
|
||||||
"src/ftxui/dom/blink.cpp",
|
|
||||||
"src/ftxui/dom/bold.cpp",
|
|
||||||
"src/ftxui/dom/border.cpp",
|
|
||||||
"src/ftxui/dom/box_helper.cpp",
|
|
||||||
"src/ftxui/dom/box_helper.hpp",
|
|
||||||
"src/ftxui/dom/canvas.cpp",
|
|
||||||
"src/ftxui/dom/clear_under.cpp",
|
|
||||||
"src/ftxui/dom/color.cpp",
|
|
||||||
"src/ftxui/dom/composite_decorator.cpp",
|
|
||||||
"src/ftxui/dom/dbox.cpp",
|
|
||||||
"src/ftxui/dom/dim.cpp",
|
|
||||||
"src/ftxui/dom/flex.cpp",
|
|
||||||
"src/ftxui/dom/flexbox.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_config.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_helper.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_helper.hpp",
|
|
||||||
"src/ftxui/dom/focus.cpp",
|
|
||||||
"src/ftxui/dom/frame.cpp",
|
|
||||||
"src/ftxui/dom/gauge.cpp",
|
|
||||||
"src/ftxui/dom/graph.cpp",
|
|
||||||
"src/ftxui/dom/gridbox.cpp",
|
|
||||||
"src/ftxui/dom/hbox.cpp",
|
|
||||||
"src/ftxui/dom/hyperlink.cpp",
|
|
||||||
"src/ftxui/dom/inverted.cpp",
|
|
||||||
"src/ftxui/dom/italic.cpp",
|
|
||||||
"src/ftxui/dom/linear_gradient.cpp",
|
|
||||||
"src/ftxui/dom/node.cpp",
|
|
||||||
"src/ftxui/dom/node_decorator.cpp",
|
|
||||||
"src/ftxui/dom/node_decorator.hpp",
|
|
||||||
"src/ftxui/dom/paragraph.cpp",
|
|
||||||
"src/ftxui/dom/reflect.cpp",
|
|
||||||
"src/ftxui/dom/scroll_indicator.cpp",
|
|
||||||
"src/ftxui/dom/selection.cpp",
|
|
||||||
"src/ftxui/dom/selection_style.cpp",
|
|
||||||
"src/ftxui/dom/separator.cpp",
|
|
||||||
"src/ftxui/dom/size.cpp",
|
|
||||||
"src/ftxui/dom/spinner.cpp",
|
|
||||||
"src/ftxui/dom/strikethrough.cpp",
|
|
||||||
"src/ftxui/dom/table.cpp",
|
|
||||||
"src/ftxui/dom/text.cpp",
|
|
||||||
"src/ftxui/dom/underlined.cpp",
|
|
||||||
"src/ftxui/dom/underlined_double.cpp",
|
|
||||||
"src/ftxui/dom/util.cpp",
|
|
||||||
"src/ftxui/dom/vbox.cpp",
|
|
||||||
],
|
|
||||||
hdrs = [
|
|
||||||
"include/ftxui/dom/canvas.hpp",
|
|
||||||
"include/ftxui/dom/deprecated.hpp",
|
|
||||||
"include/ftxui/dom/direction.hpp",
|
|
||||||
"include/ftxui/dom/elements.hpp",
|
|
||||||
"include/ftxui/dom/flexbox_config.hpp",
|
|
||||||
"include/ftxui/dom/linear_gradient.hpp",
|
|
||||||
"include/ftxui/dom/node.hpp",
|
|
||||||
"include/ftxui/dom/requirement.hpp",
|
|
||||||
"include/ftxui/dom/selection.hpp",
|
|
||||||
"include/ftxui/dom/table.hpp",
|
|
||||||
"include/ftxui/dom/take_any_args.hpp",
|
|
||||||
],
|
|
||||||
includes = ["include", "src"],
|
|
||||||
deps = [":screen"],
|
|
||||||
)
|
|
||||||
|
|
||||||
cc_test(
|
|
||||||
name = "dom_test",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/dom/blink_test.cpp",
|
|
||||||
"src/ftxui/dom/bold_test.cpp",
|
|
||||||
"src/ftxui/dom/border_test.cpp",
|
|
||||||
"src/ftxui/dom/canvas_test.cpp",
|
|
||||||
"src/ftxui/dom/color_test.cpp",
|
|
||||||
"src/ftxui/dom/dbox_test.cpp",
|
|
||||||
"src/ftxui/dom/dim_test.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_helper_test.cpp",
|
|
||||||
"src/ftxui/dom/flexbox_test.cpp",
|
|
||||||
"src/ftxui/dom/gauge_test.cpp",
|
|
||||||
"src/ftxui/dom/gridbox_test.cpp",
|
|
||||||
"src/ftxui/dom/hbox_test.cpp",
|
|
||||||
"src/ftxui/dom/hyperlink_test.cpp",
|
|
||||||
"src/ftxui/dom/italic_test.cpp",
|
|
||||||
"src/ftxui/dom/linear_gradient_test.cpp",
|
|
||||||
"src/ftxui/dom/scroll_indicator_test.cpp",
|
|
||||||
"src/ftxui/dom/separator_test.cpp",
|
|
||||||
"src/ftxui/dom/spinner_test.cpp",
|
|
||||||
"src/ftxui/dom/table_test.cpp",
|
|
||||||
"src/ftxui/dom/text_test.cpp",
|
|
||||||
"src/ftxui/dom/underlined_test.cpp",
|
|
||||||
"src/ftxui/dom/vbox_test.cpp",
|
|
||||||
],
|
|
||||||
deps = [
|
|
||||||
"//:dom",
|
|
||||||
"@googletest//:gtest_main",
|
|
||||||
],
|
|
||||||
includes = ["include", "src"],
|
|
||||||
copts = ["-std=c++20"],
|
|
||||||
testonly = True,
|
|
||||||
)
|
|
||||||
|
|
||||||
#"src/ftxui/dom/benchmark_test.cpp",
|
|
||||||
cc_library(
|
|
||||||
name = "component",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/component/maybe.cpp",
|
|
||||||
"src/ftxui/component/hoverable.cpp",
|
|
||||||
"src/ftxui/component/collapsible.cpp",
|
|
||||||
"src/ftxui/component/screen_interactive.cpp",
|
|
||||||
"src/ftxui/component/modal.cpp",
|
|
||||||
"src/ftxui/component/util.cpp",
|
|
||||||
"src/ftxui/component/animation.cpp",
|
|
||||||
"src/ftxui/component/button.cpp",
|
|
||||||
"src/ftxui/component/dropdown.cpp",
|
|
||||||
"src/ftxui/component/loop.cpp",
|
|
||||||
"src/ftxui/component/slider.cpp",
|
|
||||||
"src/ftxui/component/container.cpp",
|
|
||||||
"src/ftxui/component/renderer.cpp",
|
|
||||||
"src/ftxui/component/terminal_input_parser.cpp",
|
|
||||||
"src/ftxui/component/component_options.cpp",
|
|
||||||
"src/ftxui/component/resizable_split.cpp",
|
|
||||||
"src/ftxui/component/component.cpp",
|
|
||||||
"src/ftxui/component/event.cpp",
|
|
||||||
"src/ftxui/component/catch_event.cpp",
|
|
||||||
"src/ftxui/component/input.cpp",
|
|
||||||
"src/ftxui/component/menu.cpp",
|
|
||||||
"src/ftxui/component/window.cpp",
|
|
||||||
"src/ftxui/component/checkbox.cpp",
|
|
||||||
"src/ftxui/component/radiobox.cpp",
|
|
||||||
"src/ftxui/component/terminal_input_parser.hpp",
|
|
||||||
],
|
|
||||||
hdrs = [
|
|
||||||
"include/ftxui/component/animation.hpp",
|
|
||||||
"include/ftxui/component/captured_mouse.hpp",
|
|
||||||
"include/ftxui/component/component.hpp",
|
|
||||||
"include/ftxui/component/component_base.hpp",
|
|
||||||
"include/ftxui/component/component_options.hpp",
|
|
||||||
"include/ftxui/component/event.hpp",
|
|
||||||
"include/ftxui/component/loop.hpp",
|
|
||||||
"include/ftxui/component/mouse.hpp",
|
|
||||||
"include/ftxui/component/receiver.hpp",
|
|
||||||
"include/ftxui/component/screen_interactive.hpp",
|
|
||||||
"include/ftxui/component/task.hpp",
|
|
||||||
],
|
|
||||||
includes = [
|
|
||||||
"include",
|
|
||||||
"src",
|
|
||||||
],
|
|
||||||
strip_include_prefix = "",
|
|
||||||
include_prefix = "",
|
|
||||||
deps = [":dom"],
|
|
||||||
linkopts = ["-lpthread"],
|
|
||||||
)
|
|
||||||
|
|
||||||
#"src/ftxui/component/component_fuzzer.cpp",
|
|
||||||
#"src/ftxui/component/terminal_input_parser_test_fuzzer.cpp",
|
|
||||||
#"src/ftxui/component/hoverable_test.cpp",
|
|
||||||
#"src/ftxui/component/collapsible_test.cpp",
|
|
||||||
#"src/ftxui/component/toggle_test.cpp",
|
|
||||||
#"src/ftxui/component/screen_interactive_test.cpp",
|
|
||||||
#"src/ftxui/component/modal_test.cpp",
|
|
||||||
#"src/ftxui/component/animation_test.cpp",
|
|
||||||
#"src/ftxui/component/★ selection_test.cpp",
|
|
||||||
#"src/ftxui/component/button_test.cpp",
|
|
||||||
#"src/ftxui/component/dropdown_test.cpp",
|
|
||||||
#"src/ftxui/component/slider_test.cpp",
|
|
||||||
#"src/ftxui/component/container_test.cpp",
|
|
||||||
#"src/ftxui/component/terminal_input_parser_test.cpp",
|
|
||||||
#"src/ftxui/component/receiver_test.cpp",
|
|
||||||
#"src/ftxui/component/resizable_split_test.cpp",
|
|
||||||
#"src/ftxui/component/component_test.cpp",
|
|
||||||
#"src/ftxui/component/input_test.cpp",
|
|
||||||
#"src/ftxui/component/menu_test.cpp",
|
|
||||||
#"src/ftxui/component/radiobox_test.cpp",
|
|
||||||
|
|
||||||
cc_test(
|
|
||||||
name = "component_test",
|
|
||||||
srcs = [
|
|
||||||
"src/ftxui/component/animation_test.cpp",
|
|
||||||
"src/ftxui/component/button_test.cpp",
|
|
||||||
"src/ftxui/component/collapsible_test.cpp",
|
|
||||||
"src/ftxui/component/component_test.cpp",
|
|
||||||
"src/ftxui/component/container_test.cpp",
|
|
||||||
"src/ftxui/component/dropdown_test.cpp",
|
|
||||||
"src/ftxui/component/hoverable_test.cpp",
|
|
||||||
"src/ftxui/component/input_test.cpp",
|
|
||||||
"src/ftxui/component/menu_test.cpp",
|
|
||||||
"src/ftxui/component/modal_test.cpp",
|
|
||||||
"src/ftxui/component/radiobox_test.cpp",
|
|
||||||
"src/ftxui/component/resizable_split_test.cpp",
|
|
||||||
"src/ftxui/component/screen_interactive_test.cpp",
|
|
||||||
"src/ftxui/component/selection_test.cpp",
|
|
||||||
"src/ftxui/component/slider_test.cpp",
|
|
||||||
"src/ftxui/component/toggle_test.cpp",
|
|
||||||
],
|
|
||||||
deps = [
|
|
||||||
"//:component",
|
|
||||||
"@googletest//:gtest_main",
|
|
||||||
],
|
|
||||||
includes = ["include", "src"],
|
|
||||||
copts = ["-std=c++20"],
|
|
||||||
testonly = True,
|
|
||||||
)
|
|
||||||
34
CHANGELOG.md
34
CHANGELOG.md
@@ -1,34 +1,8 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Development
|
current (development)
|
||||||
-----------
|
---------------------
|
||||||
### Component
|
|
||||||
- Bugfix: Fix a crash with ResizeableSplit. See #1023.
|
|
||||||
- Clamp screen size to terminal size.
|
|
||||||
- Disallow `ResizeableSplit` with negative size.
|
|
||||||
|
|
||||||
### Dom
|
|
||||||
- Bugfix: Disallow specifying a negative size constraint. See #1023.
|
|
||||||
|
|
||||||
|
|
||||||
6.0.2 (2025-03-30)
|
|
||||||
-----
|
|
||||||
|
|
||||||
### Component
|
|
||||||
- BugFix: Fix major crash on Windows affecting all components. See #1020
|
|
||||||
- BugFix: Fix focusRelative.
|
|
||||||
|
|
||||||
6.0.1 (2025-03-28)
|
|
||||||
-----
|
|
||||||
|
|
||||||
Same as v6.0.0.
|
|
||||||
|
|
||||||
Due to a problem tag v6.0.0 was replaced. This isn't a good practice and affect
|
|
||||||
developers that started using it in the short timeframe. Submitting a new
|
|
||||||
release with the same content is the best way to fix this.
|
|
||||||
|
|
||||||
See #1017 and #1019.
|
|
||||||
|
|
||||||
6.0.0 (2025-03-23)
|
6.0.0 (2025-03-23)
|
||||||
-----
|
-----
|
||||||
@@ -100,10 +74,6 @@ See #1017 and #1019.
|
|||||||
- See `selectionStyleReset` decorator.
|
- See `selectionStyleReset` decorator.
|
||||||
- Breaking change: Change how "focus"/"select" are handled. This fixes the
|
- Breaking change: Change how "focus"/"select" are handled. This fixes the
|
||||||
behavior.
|
behavior.
|
||||||
- Breaking change: `Component::OnRender()` becomes the method to override to
|
|
||||||
render a component. This replaces `Component::Render()` that is still in use
|
|
||||||
to call the rendering method on the children. This change allows to fix a
|
|
||||||
couple of issues around focus handling.
|
|
||||||
|
|
||||||
### Screen
|
### Screen
|
||||||
- Feature: Add `Box::IsEmpty()`.
|
- Feature: Add `Box::IsEmpty()`.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
|
|||||||
|
|
||||||
project(ftxui
|
project(ftxui
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
VERSION 6.0.2
|
VERSION 6.0.0
|
||||||
DESCRIPTION "C++ Functional Terminal User Interface."
|
DESCRIPTION "C++ Functional Terminal User Interface."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
18
MODULE.bazel
18
MODULE.bazel
@@ -1,18 +0,0 @@
|
|||||||
# Module.
|
|
||||||
module(
|
|
||||||
name = "ftxui",
|
|
||||||
version = "6.0.2",
|
|
||||||
)
|
|
||||||
|
|
||||||
# Build deps.
|
|
||||||
bazel_dep(name = "rules_cc", version = "0.0.17")
|
|
||||||
|
|
||||||
# Test deps.
|
|
||||||
bazel_dep(name = "googletest", version = "1.15.2")
|
|
||||||
|
|
||||||
# Toolchain deps.
|
|
||||||
cc_configure = use_extension(
|
|
||||||
"@rules_cc//bzlmod:extensions.bzl",
|
|
||||||
"cc_configure",
|
|
||||||
)
|
|
||||||
use_repo(cc_configure, "local_config_cc_toolchains")
|
|
||||||
@@ -372,7 +372,7 @@ include(FetchContent)
|
|||||||
|
|
||||||
FetchContent_Declare(ftxui
|
FetchContent_Declare(ftxui
|
||||||
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
|
||||||
GIT_TAG v6.0.2
|
GIT_TAG v6.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_GetProperties(ftxui)
|
FetchContent_GetProperties(ftxui)
|
||||||
@@ -388,7 +388,7 @@ If you don't, FTXUI may be used from the following packages:
|
|||||||
- [conan.io](https://conan.io/center/ftxui)
|
- [conan.io](https://conan.io/center/ftxui)
|
||||||
- [openSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
|
- [openSUSE](https://build.opensuse.org/package/show/devel:libraries:c_c++/ftxui)
|
||||||
-
|
-
|
||||||
[](https://repology.org/project/libftxui/versions)
|
[](https://repology.org/project/ftxui/versions)
|
||||||
|
|
||||||
If you choose to build and link FTXUI yourself, `ftxui-component` must be first in the linking order relative to the other FTXUI libraries, i.e.
|
If you choose to build and link FTXUI yourself, `ftxui-component` must be first in the linking order relative to the other FTXUI libraries, i.e.
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ add_executable(ftxui-tests
|
|||||||
src/ftxui/component/menu_test.cpp
|
src/ftxui/component/menu_test.cpp
|
||||||
src/ftxui/component/modal_test.cpp
|
src/ftxui/component/modal_test.cpp
|
||||||
src/ftxui/component/radiobox_test.cpp
|
src/ftxui/component/radiobox_test.cpp
|
||||||
|
src/ftxui/util/ref_test.cpp
|
||||||
src/ftxui/component/receiver_test.cpp
|
src/ftxui/component/receiver_test.cpp
|
||||||
src/ftxui/component/resizable_split_test.cpp
|
src/ftxui/component/resizable_split_test.cpp
|
||||||
src/ftxui/component/screen_interactive_test.cpp
|
src/ftxui/component/screen_interactive_test.cpp
|
||||||
src/ftxui/component/selection_test.cpp
|
|
||||||
src/ftxui/component/slider_test.cpp
|
src/ftxui/component/slider_test.cpp
|
||||||
src/ftxui/component/terminal_input_parser_test.cpp
|
src/ftxui/component/terminal_input_parser_test.cpp
|
||||||
src/ftxui/component/toggle_test.cpp
|
src/ftxui/component/toggle_test.cpp
|
||||||
@@ -42,7 +42,7 @@ add_executable(ftxui-tests
|
|||||||
src/ftxui/dom/italic_test.cpp
|
src/ftxui/dom/italic_test.cpp
|
||||||
src/ftxui/dom/linear_gradient_test.cpp
|
src/ftxui/dom/linear_gradient_test.cpp
|
||||||
src/ftxui/dom/scroll_indicator_test.cpp
|
src/ftxui/dom/scroll_indicator_test.cpp
|
||||||
src/ftxui/util/ref_test.cpp
|
src/ftxui/dom/selection_test.cpp
|
||||||
src/ftxui/dom/separator_test.cpp
|
src/ftxui/dom/separator_test.cpp
|
||||||
src/ftxui/dom/spinner_test.cpp
|
src/ftxui/dom/spinner_test.cpp
|
||||||
src/ftxui/dom/table_test.cpp
|
src/ftxui/dom/table_test.cpp
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ class ComponentBase {
|
|||||||
|
|
||||||
// Component hierarchy:
|
// Component hierarchy:
|
||||||
ComponentBase* Parent() const;
|
ComponentBase* Parent() const;
|
||||||
Component& ChildAt(int i);
|
Component& ChildAt(size_t i);
|
||||||
int ChildCount() const;
|
size_t ChildCount() const;
|
||||||
int Index() const;
|
int Index() const;
|
||||||
void Add(Component children);
|
void Add(Component children);
|
||||||
void Detach();
|
void Detach();
|
||||||
|
|||||||
@@ -77,16 +77,16 @@ class ResizableSplitBase : public ComponentBase {
|
|||||||
|
|
||||||
switch (options_->direction()) {
|
switch (options_->direction()) {
|
||||||
case Direction::Left:
|
case Direction::Left:
|
||||||
options_->main_size() = std::max(0, event.mouse().x - box_.x_min);
|
options_->main_size() = event.mouse().x - box_.x_min;
|
||||||
return true;
|
return true;
|
||||||
case Direction::Right:
|
case Direction::Right:
|
||||||
options_->main_size() = std::max(0, box_.x_max - event.mouse().x);
|
options_->main_size() = box_.x_max - event.mouse().x;
|
||||||
return true;
|
return true;
|
||||||
case Direction::Up:
|
case Direction::Up:
|
||||||
options_->main_size() = std::max(0, event.mouse().y - box_.y_min);
|
options_->main_size() = event.mouse().y - box_.y_min;
|
||||||
return true;
|
return true;
|
||||||
case Direction::Down:
|
case Direction::Down:
|
||||||
options_->main_size() = std::max(0, box_.y_max - event.mouse().y);
|
options_->main_size() = box_.y_max - event.mouse().y;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
#include "ftxui/dom/requirement.hpp" // for Requirement
|
#include "ftxui/dom/requirement.hpp" // for Requirement
|
||||||
#include "ftxui/screen/pixel.hpp" // for Pixel
|
#include "ftxui/screen/pixel.hpp" // for Pixel
|
||||||
#include "ftxui/screen/terminal.hpp" // for Dimensions, Size
|
#include "ftxui/screen/terminal.hpp" // for Dimensions, Size
|
||||||
#include "ftxui/screen/util.hpp" // for util::clamp
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define DEFINE_CONSOLEV2_PROPERTIES
|
#define DEFINE_CONSOLEV2_PROPERTIES
|
||||||
@@ -918,15 +917,15 @@ void ScreenInteractive::Draw(Component component) {
|
|||||||
break;
|
break;
|
||||||
case Dimension::TerminalOutput:
|
case Dimension::TerminalOutput:
|
||||||
dimx = terminal.dimx;
|
dimx = terminal.dimx;
|
||||||
dimy = util::clamp(document->requirement().min_y, 0, terminal.dimy);
|
dimy = document->requirement().min_y;
|
||||||
break;
|
break;
|
||||||
case Dimension::Fullscreen:
|
case Dimension::Fullscreen:
|
||||||
dimx = terminal.dimx;
|
dimx = terminal.dimx;
|
||||||
dimy = terminal.dimy;
|
dimy = terminal.dimy;
|
||||||
break;
|
break;
|
||||||
case Dimension::FitComponent:
|
case Dimension::FitComponent:
|
||||||
dimx = util::clamp(document->requirement().min_x, 0, terminal.dimx);
|
dimx = std::min(document->requirement().min_x, terminal.dimx);
|
||||||
dimy = util::clamp(document->requirement().min_y, 0, terminal.dimy);
|
dimy = std::min(document->requirement().min_y, terminal.dimy);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Decorator focusPositionRelative(float x, float y) {
|
|||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
NodeDecorator::ComputeRequirement();
|
NodeDecorator::ComputeRequirement();
|
||||||
requirement_.focused.enabled = true;
|
requirement_.focused.enabled = false;
|
||||||
requirement_.focused.node = this;
|
requirement_.focused.node = this;
|
||||||
requirement_.focused.box.x_min = int(float(requirement_.min_x) * x_);
|
requirement_.focused.box.x_min = int(float(requirement_.min_x) * x_);
|
||||||
requirement_.focused.box.y_min = int(float(requirement_.min_y) * y_);
|
requirement_.focused.box.y_min = int(float(requirement_.min_y) * y_);
|
||||||
|
|||||||
@@ -125,8 +125,6 @@ void Render(Screen& screen, Node* node, Selection& selection) {
|
|||||||
node->Select(selection);
|
node->Select(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->requirement().focused.enabled
|
|
||||||
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
|
||||||
// Setting the cursor to the right position allow folks using CJK (China,
|
// Setting the cursor to the right position allow folks using CJK (China,
|
||||||
// Japanese, Korean, ...) characters to see their [input method editor]
|
// Japanese, Korean, ...) characters to see their [input method editor]
|
||||||
// displayed at the right location. See [issue].
|
// displayed at the right location. See [issue].
|
||||||
@@ -138,14 +136,16 @@ void Render(Screen& screen, Node* node, Selection& selection) {
|
|||||||
// https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
|
// https://github.com/ArthurSonzogni/FTXUI/issues/2#issuecomment-505282355
|
||||||
//
|
//
|
||||||
// Unfortunately, Microsoft terminal do not handle properly hiding the
|
// Unfortunately, Microsoft terminal do not handle properly hiding the
|
||||||
// cursor. Instead the character under the cursor is hidden, which is a
|
// cursor. Instead the character under the cursor is hidden, which is a big
|
||||||
// big problem. As a result, we can't enable setting cursor to the right
|
// problem. As a result, we can't enable setting cursor to the right
|
||||||
// location. It will be displayed at the bottom right corner.
|
// location. It will be displayed at the bottom right corner.
|
||||||
// See:
|
// See:
|
||||||
// https://github.com/microsoft/terminal/issues/1203
|
// https://github.com/microsoft/terminal/issues/1203
|
||||||
// https://github.com/microsoft/terminal/issues/3093
|
// https://github.com/microsoft/terminal/issues/3093
|
||||||
&&
|
if (node->requirement().focused.enabled
|
||||||
node->requirement().focused.cursor_shape != Screen::Cursor::Shape::Hidden
|
#if defined(FTXUI_MICROSOFT_TERMINAL_FALLBACK)
|
||||||
|
||
|
||||||
|
node->requirement().focused.cursor_shape == Screen::Cursor::Shape::Hidden
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
screen.SetCursor(Screen::Cursor{
|
screen.SetCursor(Screen::Cursor{
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ TEST(SelectionTest, SelectionOnChangeSquashedEvents) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(SelectionTest, StyleSelection) {
|
TEST(SelectionTest, StyleSelection) {
|
||||||
|
int selectionChangeCounter = 0;
|
||||||
|
|
||||||
auto element = hbox({
|
auto element = hbox({
|
||||||
text("Lorem "),
|
text("Lorem "),
|
||||||
text("ipsum") | selectionColor(Color::Red),
|
text("ipsum") | selectionColor(Color::Red),
|
||||||
@@ -19,7 +19,7 @@ class Size : public Node {
|
|||||||
: Node(unpack(std::move(child))),
|
: Node(unpack(std::move(child))),
|
||||||
direction_(direction),
|
direction_(direction),
|
||||||
constraint_(constraint),
|
constraint_(constraint),
|
||||||
value_(std::max(0, value)) {}
|
value_(value) {}
|
||||||
|
|
||||||
void ComputeRequirement() override {
|
void ComputeRequirement() override {
|
||||||
Node::ComputeRequirement();
|
Node::ComputeRequirement();
|
||||||
|
|||||||
Reference in New Issue
Block a user