sc/source/core/data/table1.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit bbdb62ca2f5545588b2e6d11421c6038425cebab Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Jul 25 10:08:38 2023 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Jul 25 14:33:57 2023 +0200 Resolves: tdf#156462 ctrl+left in calc doesn't always jump to the correct cell since: commit 9e2d48b9e04f7ea895fb095699c32ed8a44eb129 Date: Wed Mar 30 11:58:04 2022 +0200 reduce Calc's INITIALCOLCOUNT to 1 but: commit a680f6988482f13489d6c802b6078d43564ae934 Date: Wed Jun 7 22:48:01 2017 +0530 tdf#50916 : More refactoring in table1.cxx is likely also relevant wrt: "If nCol is in the unallocated range [nLastCol+1, MAXCOL], then move it directly to nLastCol" If the cursor is outside the allocated column range then the search started 1 cell to the left of the last allocated column Change-Id: I854173ad13d50e50d85e9902b31585e8ae3e2c0e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154885 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index fff48f1e0c3f..f6df90738c72 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1350,14 +1350,14 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo } else { - // If nCol is in the unallocated range [nLastCol+1, rDocument.MaxCol()], then move it directly to nLastCol + if(nCol == 0) + return 0; + + // If nCol is in the unallocated range [nLastCol+1, rDocument.MaxCol()], then move it directly after nLastCol // as there is no data in the unallocated range. This also makes the search faster and avoids // the need for more range checks in the loop below. if ( nCol > nLastCol ) - nCol = nLastCol; - - if(nCol == 0) - return 0; + nCol = nLastCol + 1; do {