[Libreoffice-commits] core.git: 2 commits - sw/source

Michael Stahl mstahl at redhat.com
Fri Oct 11 17:07:46 PDT 2013


 sw/source/core/crsr/findtxt.cxx |   25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

New commits:
commit b60ce8465c8f01242354abccebe00742d164af60
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Oct 12 01:54:37 2013 +0200

    sw: fix regex search/replace of $ in selection
    
    SwView::Replace() nowadays first searches for the to-be-replaced text in
    the current selection, which does not work in the corner case of "$"
    when the selection starts at end of a paragraph, as it will when
    clicking "Find" to look for "$" and then clicking "Replace".
    
    The problem is that there is some antique code in SwPaM::Find() to
    move the cursor forward if it's at the end of a paragraph, which is
    presumably some pointless micro-optimization; the result is that
    "Replace" does not replace the selected paragraph break but the
    one in the following paragraph.
    
    (regression from 68a014dbca8bbd25056f75ef551fb81a0dbfb1b7)
    
    Change-Id: I5aae9c272d102a48166c63e01775dc6322f9f02d

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index c41be12..76b44c2 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -221,22 +221,6 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
     SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
     SwIndex& rCntntIdx = pPam->GetPoint()->nContent;
 
-    // If a beginning/end, from out of node; stop if empty node
-    if( bSrchForward
-        ? ( rCntntIdx.GetIndex() == pPam->GetCntntNode()->Len() &&
-            rCntntIdx.GetIndex() )
-        : !rCntntIdx.GetIndex() && pPam->GetCntntNode()->Len() )
-    {
-        if( !(*fnMove->fnNds)( &rNdIdx, sal_False ))
-        {
-            delete pPam;
-            return false;
-        }
-        SwCntntNode *pNd = rNdIdx.GetNode().GetCntntNode();
-        xub_StrLen nTmpPos = bSrchForward ? 0 : pNd->Len();
-        rCntntIdx.Assign( pNd, nTmpPos );
-    }
-
     // If bFound is true then the string was found and is between nStart and nEnd
     bool bFound = false;
     // start position in text or initial position
commit dca5163b6ef206ceb1f2d56feb7546c1929afe60
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Oct 12 01:53:51 2013 +0200

    fdo#64495: sw: fix regex search for soft hyphen \xAD
    
    The problem is that the soft hyphen apparently needs special handling,
    and SwPaM::DoSearch() looked for the no longer supported legacy syntax,
    not for any of the unicode character syntax that ICU regex supports.
    
    Change-Id: I754296d2cf9286242e083cc7906ce3b8fda78dd5

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index d4110e6..c41be12 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -416,9 +416,14 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
 
     if ( bRegSearch )
     {
-        const OUString a00AD("\\x00AD");
-        if ( -1 != rSearchOpt.searchString.indexOf( a00AD ) )
+        if (   -1 != rSearchOpt.searchString.indexOf("\\xAD")
+            || -1 != rSearchOpt.searchString.indexOf("\\x{00AD}")
+            || -1 != rSearchOpt.searchString.indexOf("\\u00AD")
+            || -1 != rSearchOpt.searchString.indexOf("\\U000000AD")
+            || -1 != rSearchOpt.searchString.indexOf("\\N{SOFT HYPHEN}"))
+        {
              bRemoveSoftHyphens = false;
+        }
     }
     else
     {


More information about the Libreoffice-commits mailing list