[Libreoffice-commits] core.git: editeng/source

László Németh nemeth at numbertext.org
Fri Aug 29 04:24:44 PDT 2014


 editeng/source/misc/svxacorr.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit f78eeee1b7c6599589c37b456c4b2f1c6c2e249c
Author: László Németh <nemeth at numbertext.org>
Date:   Fri Aug 29 13:01:55 2014 +0200

    fdo#62923 Autocorrect opt. 'Replace dashes' uses en-dash between numbers
    
    to avoid the bad replacement of the frequent number ranges between
    years, page numbers etc., more information:
    
    http://en.wikipedia.org/wiki/Dash
    
    Change-Id: I9cae6bcbc227e80d59e091be591448c9289371eb

diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 5fb9424..9aae335 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -586,7 +586,8 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
         }
     }
 
-    // Replace [A-z0-9]--[A-z0-9] double dash with "emDash" or "enDash".
+    // Replace [A-z0-9]--[A-z0-9] double dash with "emDash" or "enDash"
+    // [0-9]--[0-9] double dash always replaced with "enDash"
     // Finnish and Hungarian use enDash instead of emDash.
     bool bEnDash = (eLang == LANGUAGE_HUNGARIAN || eLang == LANGUAGE_FINNISH);
     if( ((cEmDash && !bEnDash) || (cEnDash && bEnDash)) && 4 <= nEndPos - nSttPos )
@@ -602,7 +603,8 @@ bool SvxAutoCorrect::FnChgToEnEmDash(
         {
             nSttPos = nSttPos + nFndPos;
             rDoc.Delete( nSttPos, nSttPos + 2 );
-            rDoc.Insert( nSttPos, (bEnDash ? OUString(cEnDash) : OUString(cEmDash)) );
+            rDoc.Insert( nSttPos, (bEnDash || (rCC.isDigit( sTmp, nFndPos - 1 ) &&
+                rCC.isDigit( sTmp, nFndPos + 2 )) ? OUString(cEnDash) : OUString(cEmDash)) );
             bRet = true;
         }
     }


More information about the Libreoffice-commits mailing list