From 78f091833956c2c08459cc06e47e01bfb8e63967 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Fri, 17 Apr 2026 19:48:58 +0100 Subject: algo/scroll: add center for centering the current col (#14059) ref #14027 --- src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/layout/algorithm') diff --git a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp index 5685d650..83ab0974 100644 --- a/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp +++ b/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp @@ -1475,6 +1475,17 @@ std::expected CScrollingAlgorithm::layoutMsg(const std::strin m_scrollingData->centerOrFitCol(CURRENT_COL); m_scrollingData->recalculate(); + } else if (ARGS[0] == "center") { + const auto TDATA = dataFor(Desktop::focusState()->window() ? Desktop::focusState()->window()->layoutTarget() : nullptr); + if (!TDATA) + return std::unexpected("no window"); + + const auto CURRENT_COL = TDATA->column.lock(); + if (!CURRENT_COL) + return std::unexpected("no current col"); + + m_scrollingData->centerCol(CURRENT_COL); + m_scrollingData->recalculate(); } else return std::unexpected("no such layoutmsg for scrolling"); -- cgit v1.2.3