consider field marks as text for auto quotes

f41
Caolán McNamara 8 years ago
parent 03601f0ab7
commit 71f3062668

@ -0,0 +1,62 @@
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

@ -244,6 +244,8 @@ Patch0: 0001-don-t-suppress-crashes.patch
Patch1: 0001-Related-tdf-106100-recover-mangled-svg-in-presentati.patch
# not upstreamed
Patch2: 0001-Resolves-rhbz-1432468-disable-opencl-by-default.patch
Patch3: 0001-rename-IsAutoCapitalizeWordDelim-to-NonFieldWordDeli.patch
Patch4: 0002-consider-field-marks-as-text-for-auto-quotes.patch
%if 0%{?rhel}
# not upstreamed

Loading…
Cancel
Save