summaryrefslogtreecommitdiff
path: root/src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2026-04-17 19:48:58 +0100
committerGitHub <noreply@github.com>2026-04-17 19:48:58 +0100
commit78f091833956c2c08459cc06e47e01bfb8e63967 (patch)
tree59eb926e5fef4b20d6731274a571481a46ea45b2 /src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp
parentf75a14d19e255356543ff4687089a6b9c1f91488 (diff)
algo/scroll: add center for centering the current col (#14059)
ref #14027
Diffstat (limited to 'src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp')
-rw-r--r--src/layout/algorithm/tiled/scrolling/ScrollingAlgorithm.cpp11
1 files changed, 11 insertions, 0 deletions
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<void, std::string> 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");