diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3bcca1e7..2eafd16b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,18 +19,16 @@ jobs: - name: Linux GCC os: ubuntu-latest compiler: gcc - gcov_executable: gcov - name: Linux Clang os: ubuntu-latest compiler: llvm gcov_executable: "llvm-cov gcov" - # https://github.com/aminya/setup-cpp/issues/246 - #- name: MacOS clang - #os: macos-latest - #compiler: llvm - #gcov_executable: "llvm-cov gcov" + - name: MacOS clang + os: macos-latest + compiler: llvm + gcov_executable: "llvm-cov gcov" - name: Windows MSVC os: windows-latest @@ -85,7 +83,7 @@ jobs: ctest -C Debug --rerun-failed --output-on-failure; - name: Unix - coverage - if: runner.os != 'Windows' + if: matrix.gcov_executable != '' working-directory: ./build run: > gcovr @@ -106,7 +104,7 @@ jobs: --gcov-executable '${{ matrix.gcov_executable }}'; - name: Windows - Test and coverage - if: runner.os == 'Windows' + if: runner.os == 'Windows' && false working-directory: ./build run: > OpenCppCoverage.exe diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 9f7f4d63..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,76 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - push: - branches: [ "main" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] - schedule: - - cron: '45 22 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Use only 'java' to analyze code written in Java, Kotlin or both - # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" diff --git a/examples/component/button.cpp b/examples/component/button.cpp index 501dc7e1..63032f42 100644 --- a/examples/component/button.cpp +++ b/examples/component/button.cpp @@ -1,64 +1,9 @@ -// Copyright 2020 Arthur Sonzogni. All rights reserved. -// Use of this source code is governed by the MIT license that can be found in -// the LICENSE file. -#include // for shared_ptr, __shared_ptr_access -#include // for operator+, to_string +#include "ftxui/component/component.hpp" +#include "ftxui/component/screen_interactive.hpp" -#include "ftxui/component/captured_mouse.hpp" // for ftxui -#include "ftxui/component/component.hpp" // for Button, Horizontal, Renderer -#include "ftxui/component/component_base.hpp" // for ComponentBase -#include "ftxui/component/screen_interactive.hpp" // for ScreenInteractive -#include "ftxui/dom/elements.hpp" // for separator, gauge, text, Element, operator|, vbox, border - -using namespace ftxui; - -// This is a helper function to create a button with a custom style. -// The style is defined by a lambda function that takes an EntryState and -// returns an Element. -// We are using `center` to center the text inside the button, then `border` to -// add a border around the button, and finally `flex` to make the button fill -// the available space. -ButtonOption Style() { - auto option = ButtonOption::Animated(); - option.transform = [](const EntryState& s) { - auto element = text(s.label); - if (s.focused) { - element |= bold; - } - return element | center | borderEmpty | flex; - }; - return option; -} - -int main() { - int value = 50; - - // clang-format off - auto btn_dec_01 = Button("-1", [&] { value -= 1; }, Style()); - auto btn_inc_01 = Button("+1", [&] { value += 1; }, Style()); - auto btn_dec_10 = Button("-10", [&] { value -= 10; }, Style()); - auto btn_inc_10 = Button("+10", [&] { value += 10; }, Style()); - // clang-format on - - // The tree of components. This defines how to navigate using the keyboard. - // The selected `row` is shared to get a grid layout. - int row = 0; - auto buttons = Container::Vertical({ - Container::Horizontal({btn_dec_01, btn_inc_01}, &row) | flex, - Container::Horizontal({btn_dec_10, btn_inc_10}, &row) | flex, - }); - - // Modify the way to render them on screen: - auto component = Renderer(buttons, [&] { - return vbox({ - text("value = " + std::to_string(value)), - separator(), - buttons->Render() | flex, - }) | - flex | border; - }); - - auto screen = ScreenInteractive::FitComponent(); - screen.Loop(component); - return 0; +int main(){ + auto screen = ftxui::ScreenInteractive::Fullscreen(); + auto testComponent = ftxui::Renderer([](){return ftxui::text("test Component");}); + screen.Loop(testComponent); + return 0; } diff --git a/src/ftxui/dom/frame.cpp b/src/ftxui/dom/frame.cpp index 43509147..bbfb4736 100644 --- a/src/ftxui/dom/frame.cpp +++ b/src/ftxui/dom/frame.cpp @@ -102,11 +102,11 @@ Element focus(Element child) { return std::make_shared(unpack(std::move(child))); } -/// @deprecated Use `focus` instead. +/// This is deprecated. Use `focus` instead. /// @brief Set the `child` to be the one focused among its siblings. /// @param child The element to be focused. -Element select(Element e) { - return focus(std::move(e)); +Element select(Element child) { + return focus(std::move(child)); } /// @brief Allow an element to be displayed inside a 'virtual' area. It size can