Skip to content

Commit

Permalink
Bump of boxed-cpp and code update
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut authored and christianparpart committed Feb 11, 2024
1 parent 3faac53 commit 73d0d5e
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 97 deletions.
2 changes: 1 addition & 1 deletion cmake/ContourThirdParties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ else()
set(THIRDPARTY_BUILTIN_termbench "(bench-headless disabled)")
endif()

set(BOXED_CPP_MINIMAL_VERSION "1.2.2")
set(BOXED_CPP_MINIMAL_VERSION "1.3.0")
if(COMMAND ContourThirdParties_Embed_boxed_cpp)
ContourThirdParties_Embed_boxed_cpp()
subproject_version(boxed-cpp boxed_cpp_version)
Expand Down
6 changes: 3 additions & 3 deletions scripts/install-deps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ $ThirdParties =
Macro = "termbench_pro"
}
[ThirdParty]@{
Folder = "boxed-cpp-1.2.2";
Archive = "boxed-cpp-1.2.2.zip";
URI = "https://github.com/contour-terminal/boxed-cpp/archive/refs/tags/v1.2.2.zip";
Folder = "boxed-cpp-1.3.0";
Archive = "boxed-cpp-1.3.0.zip";
URI = "https://github.com/contour-terminal/boxed-cpp/archive/refs/tags/v1.3.0.zip";
Macro = "boxed_cpp"
}
)
Expand Down
2 changes: 1 addition & 1 deletion scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ fetch_and_unpack_termbenchpro()

fetch_and_unpack_boxed()
{
local boxed_cpp_version="1.2.2"
local boxed_cpp_version="1.3.0"
fetch_and_unpack \
boxed-cpp-$boxed_cpp_version \
boxed-cpp-$boxed_cpp_version.tar.gz \
Expand Down
8 changes: 1 addition & 7 deletions src/vtbackend/Hyperlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,7 @@ struct HyperlinkInfo
}
};

namespace detail
{
struct HyperlinkTag
{
};
} // namespace detail
using HyperlinkId = boxed::boxed<uint16_t, detail::HyperlinkTag>;
using HyperlinkId = boxed::boxed<uint16_t>;

bool is_local(HyperlinkInfo const& hyperlink);

Expand Down
11 changes: 2 additions & 9 deletions src/vtbackend/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ enum class ImageFormat
RGBA,
};

// clang-format off
namespace detail { struct ImageId {}; }
using ImageId = boxed::boxed<uint32_t, detail::ImageId>; // unique numerical image identifier
// clang-format on
using ImageId = boxed::boxed<uint32_t>; // unique numerical image identifier

struct ImageStats
{
Expand Down Expand Up @@ -198,11 +195,7 @@ class ImageFragment
CellLocation _offset;
};

namespace detail
{
struct ImageFragmentId;
}
using ImageFragmentId = boxed::boxed<uint16_t, detail::ImageFragmentId>;
using ImageFragmentId = boxed::boxed<uint16_t>;

inline bool operator==(ImageFragment const& a, ImageFragment const& b) noexcept
{
Expand Down
54 changes: 12 additions & 42 deletions src/vtbackend/primitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,15 @@ using LineCount = vtpty::LineCount;
using ColumnCount = vtpty::ColumnCount;
using PageSize = vtpty::PageSize;

namespace detail::tags // {{{
{
// clang-format off
// column types
struct ColumnOffset {};
struct ColumnPosition {};

// line types
struct LineOffset {};
struct ScrollOffset {};

// misc.
struct TabStopCount {};

// generic length
struct Length {};

// range
struct From {};
struct To {};

// margin
struct Top {};
struct Left {};
struct Bottom {};
struct Right {};
// clang-format on
} // namespace detail::tags
// }}}

// {{{ Column types

/// ColumnPosition represents the absolute column on the visibile screen area
/// (usually the main page unless scrolled upwards).
///
/// A column position starts at 1.
using ColumnPosition = boxed::boxed<int, detail::tags::ColumnPosition>;
using ColumnPosition = boxed::boxed<int>;

using ColumnOffset = boxed::boxed<int, detail::tags::ColumnOffset>;
using ColumnOffset = boxed::boxed<int>;

// }}}
// {{{ Line types
Expand All @@ -75,15 +45,15 @@ using MaxHistoryLineCount = std::variant<LineCount, Infinite>;
///
/// * 0 is top-most line on main page
/// * -1 is the bottom most line in scrollback
using LineOffset = boxed::boxed<int, detail::tags::LineOffset>;
using LineOffset = boxed::boxed<int>;

/// Represents the number of lines the viewport has been scrolled up into
/// the scrollback lines history.
///
/// A value of 0 means that it is not scrolled at all (bottom), and
/// a value equal to the number of scrollback lines means it is scrolled
/// to the top.
using ScrollOffset = boxed::boxed<int, detail::tags::ScrollOffset>;
using ScrollOffset = boxed::boxed<int>;

constexpr int operator*(LineCount a, ColumnCount b) noexcept
{
Expand Down Expand Up @@ -222,10 +192,10 @@ struct ColumnRange
// {{{ Range

/// Represents the first value of a range.
using From = boxed::boxed<int, detail::tags::From>;
using From = boxed::boxed<int>;

/// Represents the last value of a range (inclusive).
using To = boxed::boxed<int, detail::tags::To>;
using To = boxed::boxed<int>;

// Range (e.g. a range of lines from X to Y).
struct Range
Expand All @@ -248,10 +218,10 @@ struct Range

// Rectangular operations
//
using Top = boxed::boxed<int, detail::tags::Top>;
using Left = boxed::boxed<int, detail::tags::Left>;
using Bottom = boxed::boxed<int, detail::tags::Bottom>;
using Right = boxed::boxed<int, detail::tags::Right>;
using Top = boxed::boxed<int>;
using Left = boxed::boxed<int>;
using Bottom = boxed::boxed<int>;
using Right = boxed::boxed<int>;

// Rectangular screen operations
//
Expand Down Expand Up @@ -294,7 +264,7 @@ constexpr Range vertical(PageMargin m) noexcept
// {{{ Length

// Lengths and Ranges
using Length = boxed::boxed<int, detail::tags::Length>;
using Length = boxed::boxed<int>;

// }}}
// {{{ Coordinate types
Expand Down Expand Up @@ -380,7 +350,7 @@ constexpr GridSize::iterator end(GridSize const& s) noexcept
// }}}
// {{{ misc

using TabStopCount = boxed::boxed<int, detail::tags::TabStopCount>;
using TabStopCount = boxed::boxed<int>;

// }}}
// {{{ convenience methods
Expand Down
13 changes: 2 additions & 11 deletions src/vtpty/ImageSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,11 @@

namespace vtpty
{

// clang-format off
namespace detail::tags
{
struct Width {};
struct Height {};
}
// clang-format on

/// Representsthe width in pixels of an image (see ImageSize).
using Width = boxed::boxed<unsigned, detail::tags::Width>;
using Width = boxed::boxed<unsigned>;

/// Representsthe height in pixels of an image (see ImageSize).
using Height = boxed::boxed<unsigned, detail::tags::Height>;
using Height = boxed::boxed<unsigned>;

/// ImageSize represents the 2-dimensional size of an image (pixmap).
struct ImageSize
Expand Down
15 changes: 2 additions & 13 deletions src/vtpty/PageSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,11 @@

namespace vtpty
{

namespace detail::tags
{
struct LineCount
{
};
struct ColumnCount
{
};
} // namespace detail::tags

/// ColumnCount simply represents a number of columns.
using ColumnCount = boxed::boxed<int, detail::tags::ColumnCount>;
using ColumnCount = boxed::boxed<int>;

/// LineCount represents a number of lines.
using LineCount = boxed::boxed<int, detail::tags::LineCount>;
using LineCount = boxed::boxed<int>;

struct PageSize
{
Expand Down
12 changes: 2 additions & 10 deletions src/vtpty/Pty.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,8 @@
namespace vtpty
{

namespace detail
{
// clang-format off
struct PtyMasterHandle {};
struct PtySlaveHandle {};
// clang-format on
} // namespace detail

using PtyMasterHandle = boxed::boxed<std::uintptr_t, detail::PtyMasterHandle>;
using PtySlaveHandle = boxed::boxed<std::uintptr_t, detail::PtySlaveHandle>;
using PtyMasterHandle = boxed::boxed<std::uintptr_t>;
using PtySlaveHandle = boxed::boxed<std::uintptr_t>;
using PtyHandle = std::uintptr_t;

class PtySlave
Expand Down

0 comments on commit 73d0d5e

Please sign in to comment.