diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-04-27 18:36:56 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-04-28 05:51:31 +0200 |
commit | ee57936475064b409565490022f414220656e12c (patch) | |
tree | 01f0f8003b2fddfa7331cb8031e9ff3094fa6fe2 | |
parent | 4c0939f900b862ae8abe585617d51898a7c0caf0 (diff) |
fix horizontal Calc cursor skipping
UITest_calc_tests' columns.CalcColumns.test_column_hide_show fails
with INITIALCOLCOUNT being 1 because column C was hidden, but
searching only up to the first allocated column + 1 searched only
up to column B. Whether an entire column is hidden is not part
of ScColumn, it's stored in ScTable.
Change-Id: Ib1befe5cd0db8d50a6196bc6621fb1b0967e6209
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133524
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | sc/source/ui/view/tabview2.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 654590a74152..400ea89b6106 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -739,8 +739,16 @@ void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SC bool bSkipCell = false; bool bHFlip = false; - // search also the first unallocated column (all unallocated columns share a set of attrs) - SCCOL nMaxCol = std::min<SCCOL>( rDoc.GetAllocatedColumnsCount(nTab) + 1, rDoc.MaxCol()); + // If a number of last columns are hidden, search up to and including the first of them, + // because after it nothing changes. + SCCOL nMaxCol; + if(rDoc.ColHidden(rDoc.MaxCol(), nTab, &nMaxCol)) + ++nMaxCol; + else + nMaxCol = rDoc.MaxCol(); + // Search also at least up to and including the first unallocated column (all unallocated columns + // share a set of attrs). + nMaxCol = std::max( nMaxCol, std::min<SCCOL>( rDoc.GetAllocatedColumnsCount(nTab) + 1, rDoc.MaxCol())); do { bSkipCell = rDoc.ColHidden(rCurX, nTab) || rDoc.IsHorOverlapped(rCurX, rCurY, nTab); |