You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.4 KiB
63 lines
2.4 KiB
From 1f44a635681af51a213f69d0fc60ec91a4458f09 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
Date: Mon, 19 Jun 2017 15:02:17 +0100
|
|
Subject: [PATCH 2/2] consider field marks as text for auto quotes
|
|
|
|
Change-Id: I511a13f7785a0de6efaa8439d3f0bff20a1644ed
|
|
---
|
|
editeng/qa/unit/core-test.cxx | 17 +++++++++++++++++
|
|
editeng/source/misc/svxacorr.cxx | 2 +-
|
|
2 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
|
|
index f620a72..b71c90c 100644
|
|
--- a/editeng/qa/unit/core-test.cxx
|
|
+++ b/editeng/qa/unit/core-test.cxx
|
|
@@ -375,6 +375,7 @@ void Test::testAutocorrect()
|
|
CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult());
|
|
}
|
|
|
|
+ // don't autocapitalize after a field mark
|
|
{
|
|
OUString sInput("Test. \x01 test");
|
|
sal_Unicode cNextChar(' ');
|
|
@@ -385,6 +386,22 @@ void Test::testAutocorrect()
|
|
|
|
CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult());
|
|
}
|
|
+
|
|
+ // consider field contents as text for auto quotes
|
|
+ {
|
|
+ OUString sInput("T\x01");
|
|
+ sal_Unicode cNextChar('"');
|
|
+ const sal_Unicode EXPECTED[] = { 'T', 0x01, 0x0201d };
|
|
+ OUString sExpected(EXPECTED, SAL_N_ELEMENTS(EXPECTED));
|
|
+
|
|
+ TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US);
|
|
+ aAutoCorrect.SetAutoCorrFlag(ChgQuotes, true);
|
|
+ aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true);
|
|
+ fprintf(stderr, "text is %x\n", aFoo.getResult()[aFoo.getResult().getLength() - 1]);
|
|
+
|
|
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult());
|
|
+ }
|
|
+
|
|
}
|
|
|
|
void Test::testHyperlinkCopyPaste()
|
|
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
|
|
index c7ec14c..d8804dc 100644
|
|
--- a/editeng/source/misc/svxacorr.cxx
|
|
+++ b/editeng/source/misc/svxacorr.cxx
|
|
@@ -1258,7 +1258,7 @@ void SvxAutoCorrect::DoAutoCorrect( SvxAutoCorrDoc& rDoc, const OUString& rTxt,
|
|
{
|
|
sal_Unicode cPrev;
|
|
bool bSttQuote = !nInsPos ||
|
|
- IsWordDelim( ( cPrev = rTxt[ nInsPos-1 ])) ||
|
|
+ NonFieldWordDelim( ( cPrev = rTxt[ nInsPos-1 ])) ||
|
|
lcl_IsInAsciiArr( "([{", cPrev ) ||
|
|
( cEmDash && cEmDash == cPrev ) ||
|
|
( cEnDash && cEnDash == cPrev );
|
|
--
|
|
2.9.3
|
|
|