sc/source/core/data/table1.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit 6f67c238f69e6d3b83967547de2f6649f0af766d Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Jul 25 10:08:38 2023 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Aug 1 16:03:53 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/+/154869 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index c5d4de055f8d..5e40d9bc4381 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1342,14 +1342,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 {