From d38b14ffb62c273a80813997df0086614b2cbdb8 Mon Sep 17 00:00:00 2001
From: Mark Antabi <121069920+hexmarsh@users.noreply.github.com>
Date: Sun, 28 Apr 2024 08:48:02 -0400
Subject: [PATCH] Allow user to specify window element border. (#849)

---
 include/ftxui/dom/elements.hpp |  4 +++-
 src/ftxui/dom/border.cpp       | 11 +++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/ftxui/dom/elements.hpp b/include/ftxui/dom/elements.hpp
index 721674af..b2d1b8b7 100644
--- a/include/ftxui/dom/elements.hpp
+++ b/include/ftxui/dom/elements.hpp
@@ -80,7 +80,9 @@ Decorator borderStyled(BorderStyle);
 Decorator borderStyled(BorderStyle, Color);
 Decorator borderStyled(Color);
 Decorator borderWith(const Pixel&);
-Element window(Element title, Element content);
+Element window(Element title,
+               Element content,
+               BorderStyle border = ROUNDED);
 Element spinner(int charset_index, size_t image_index);
 Element paragraph(const std::string& text);
 Element paragraphAlignLeft(const std::string& text);
diff --git a/src/ftxui/dom/border.cpp b/src/ftxui/dom/border.cpp
index 9767f811..5616a560 100644
--- a/src/ftxui/dom/border.cpp
+++ b/src/ftxui/dom/border.cpp
@@ -479,6 +479,7 @@ Element borderEmpty(Element child) {
 /// @brief Draw window with a title and a border around the element.
 /// @param title The title of the window.
 /// @param content The element to be wrapped.
+/// @param border The style of the border. Default is ROUNDED.
 /// @ingroup dom
 /// @see border
 ///
@@ -488,6 +489,12 @@ Element borderEmpty(Element child) {
 /// Element document = window(text("Title"),
 ///                           text("content")
 ///                    );
+///
+/// // With specifying border
+/// Element document = window(text("Title"),
+///                           text("content"),
+///                           ROUNDED
+///                    );
 /// ```
 ///
 /// ### Output
@@ -497,8 +504,8 @@ Element borderEmpty(Element child) {
 /// │content│
 /// └───────┘
 /// ```
-Element window(Element title, Element content) {
+Element window(Element title, Element content, BorderStyle border) {
   return std::make_shared<Border>(unpack(std::move(content), std::move(title)),
-                                  ROUNDED);
+                                  border);
 }
 }  // namespace ftxui
-- 
GitLab