summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2021-09-04 20:29:28 +0300
committerEike Rathke <erack@redhat.com>2021-09-06 15:20:36 +0200
commit51964092e9a4e57c9455795e50c118fca8d8e0e6 (patch)
tree956d35327fdeda18daa9271b0bbf4dbc93db934f
parenttdf#105689: fix path management to retrieve Emoji toolbar button (diff)
downloadcore-51964092e9a4e57c9455795e50c118fca8d8e0e6.tar.gz
core-51964092e9a4e57c9455795e50c118fca8d8e0e6.zip
Revert "tdf#142214: autocomplete: do not search across empty blocks"
This reverts commit ca2ec443893731093970914feb750b31ea13e47f. Breaks user experience. Removed ScTiledRenderingTest::testAutoInputStringBlock as well. Change-Id: Id03bc645d78c29c0aa588b2133fc1cb96f3cceb3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121640 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> (cherry picked from commit 223f3a6fac43580114bca86abb34d7cf3219f4bc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121569 Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx37
-rw-r--r--sc/qa/unit/ucalc.cxx19
-rw-r--r--sc/source/core/data/column3.cxx28
3 files changed, 11 insertions, 73 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index aed61f58a6cf..8a722c2b8a29 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -114,7 +114,6 @@ public:
void testSpellOnlineRenderParameter();
void testPasteIntoWrapTextCell();
void testSortAscendingDescending();
- void testAutoInputStringBlock();
void testAutoInputExactMatch();
void testMoveShapeHandle();
void testEditCursorBounds();
@@ -167,7 +166,6 @@ public:
CPPUNIT_TEST(testSpellOnlineRenderParameter);
CPPUNIT_TEST(testPasteIntoWrapTextCell);
CPPUNIT_TEST(testSortAscendingDescending);
- CPPUNIT_TEST(testAutoInputStringBlock);
CPPUNIT_TEST(testAutoInputExactMatch);
CPPUNIT_TEST(testMoveShapeHandle);
CPPUNIT_TEST(testEditCursorBounds);
@@ -2650,41 +2648,6 @@ void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, ScTabV
Scheduler::ProcessEventsToIdle();
}
-void ScTiledRenderingTest::testAutoInputStringBlock()
-{
- comphelper::LibreOfficeKit::setActive();
-
- ScModelObj* pModelObj = createDoc("empty.ods");
- CPPUNIT_ASSERT(pModelObj);
- ScTabViewShell* pView = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
- CPPUNIT_ASSERT(pView);
- ScDocument* pDoc = pModelObj->GetDocument();
-
- pDoc->SetString(ScAddress(0, 3, 0), "ABC"); // A4
- pDoc->SetString(ScAddress(0, 4, 0), "BAC"); // A5
- ScFieldEditEngine& rEE = pDoc->GetEditEngine();
- rEE.SetText("XYZ");
- pDoc->SetEditText(ScAddress(0, 5, 0), rEE.CreateTextObject()); // A6
- pDoc->SetValue(ScAddress(0, 6, 0), 123);
- pDoc->SetString(ScAddress(0, 7, 0), "ZZZ"); // A8
-
- ScAddress aA1(0, 0, 0);
- lcl_typeCharsInCell("X", aA1.Col(), aA1.Row(), pView, pModelObj); // Type 'X' in A1
- CPPUNIT_ASSERT_EQUAL_MESSAGE("A1 should not autocomplete", OUString("X"), pDoc->GetString(aA1));
-
- ScAddress aA3(0, 2, 0); // Adjacent to the string "superblock" A4:A8
- lcl_typeCharsInCell("X", aA3.Col(), aA3.Row(), pView, pModelObj); // Type 'X' in A3
- CPPUNIT_ASSERT_EQUAL_MESSAGE("A3 should autocomplete", OUString("XYZ"), pDoc->GetString(aA3));
-
- ScAddress aA9(0, 8, 0); // Adjacent to the string "superblock" A4:A8
- lcl_typeCharsInCell("X", aA9.Col(), aA9.Row(), pView, pModelObj); // Type 'X' in A9
- CPPUNIT_ASSERT_EQUAL_MESSAGE("A9 should autocomplete", OUString("XYZ"), pDoc->GetString(aA9));
-
- ScAddress aA11(0, 10, 0);
- lcl_typeCharsInCell("X", aA11.Col(), aA11.Row(), pView, pModelObj); // Type 'X' in A11
- CPPUNIT_ASSERT_EQUAL_MESSAGE("A11 should not autocomplete", OUString("X"), pDoc->GetString(aA11));
-}
-
void ScTiledRenderingTest::testAutoInputExactMatch()
{
comphelper::LibreOfficeKit::setActive();
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9a7a3e34d623..6019c97fea97 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -816,22 +816,14 @@ void Test::testDataEntries()
m_pDoc->SetString(ScAddress(0,5,0), "Andy");
m_pDoc->SetString(ScAddress(0,6,0), "Bruce");
m_pDoc->SetString(ScAddress(0,7,0), "Charlie");
- m_pDoc->SetValue(ScAddress(0,8,0), 100);
- m_pDoc->SetValue(ScAddress(0,9,0), 200);
m_pDoc->SetString(ScAddress(0,10,0), "Andy");
- m_pDoc->SetValue(ScAddress(0,11,0), 1000);
std::vector<ScTypedStrData> aEntries;
- m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the top.
- std::vector<ScTypedStrData>::const_iterator it = aEntries.begin();
- CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end()));
-
- aEntries.clear();
- m_pDoc->GetDataEntries(0, 4, 0, aEntries); // Try at A5.
+ m_pDoc->GetDataEntries(0, 0, 0, aEntries); // Try at the very top.
// Entries are supposed to be sorted in ascending order, and are all unique.
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aEntries.size());
- it = aEntries.begin();
+ std::vector<ScTypedStrData>::const_iterator it = aEntries.begin();
CPPUNIT_ASSERT_EQUAL(OUString("Andy"), it->GetString());
++it;
CPPUNIT_ASSERT_EQUAL(OUString("Bruce"), it->GetString());
@@ -841,7 +833,7 @@ void Test::testDataEntries()
CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end()));
aEntries.clear();
- m_pDoc->GetDataEntries(0, 12, 0, aEntries); // Try at A13.
+ m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the very bottom.
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aEntries.size());
// Make sure we get the same set of suggestions.
@@ -854,11 +846,6 @@ void Test::testDataEntries()
++it;
CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end()));
- aEntries.clear();
- m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the bottom.
- it = aEntries.begin();
- CPPUNIT_ASSERT_MESSAGE("The entries should be empty.", bool(it == aEntries.end()));
-
m_pDoc->DeleteTab(0);
}
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 8faa97d2a050..49c646073e27 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2592,11 +2592,6 @@ public:
return (maPos.first->type == sc::element_type_string || maPos.first->type == sc::element_type_edittext);
}
- bool isEmpty() const
- {
- return maPos.first->type == sc::element_type_empty;
- }
-
bool prev()
{
if (!has())
@@ -2604,7 +2599,7 @@ public:
// Not in a string block. Move back until we hit a string block.
while (!has())
{
- if (isEmpty() || maPos.first == miBeg)
+ if (maPos.first == miBeg)
return false;
--maPos.first; // move to the preceding block.
@@ -2630,10 +2625,6 @@ public:
// Move to the last cell of the previous block.
--maPos.first;
maPos.second = maPos.first->size - 1;
-
- if (isEmpty())
- return false;
-
if (has())
break;
}
@@ -2648,9 +2639,6 @@ public:
// Not in a string block. Move forward until we hit a string block.
while (!has())
{
- if (isEmpty())
- return false;
-
++maPos.first;
if (maPos.first == miEnd)
return false;
@@ -2672,10 +2660,6 @@ public:
return false;
maPos.second = 0;
-
- if (isEmpty())
- return false;
-
if (has())
break;
}
@@ -2711,12 +2695,16 @@ bool ScColumn::GetDataEntries(
// going upward and downward directions in parallel. The start position
// cell must be skipped.
- StrCellIterator aItrUp(maCells, nStartRow-1, &GetDoc());
+ StrCellIterator aItrUp(maCells, nStartRow, &GetDoc());
StrCellIterator aItrDown(maCells, nStartRow+1, &GetDoc());
bool bMoveUp = aItrUp.valid();
- if (bMoveUp && !aItrUp.has())
- bMoveUp = aItrUp.prev(); // Find the previous string cell position.
+ if (!bMoveUp)
+ // Current cell is invalid.
+ return false;
+
+ // Skip the start position cell.
+ bMoveUp = aItrUp.prev(); // Find the previous string cell position.
bool bMoveDown = aItrDown.valid();
if (bMoveDown && !aItrDown.has())