From: Jürgen Vigna Date: Mon, 13 Aug 2001 10:09:50 +0000 (+0000) Subject: Fixed bug that did not single replace words with casesensitive off sometimes. X-Git-Tag: 1.6.10~20850 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4a2096fff15c7a480730f50608b2df4fa688e424;p=features.git Fixed bug that did not single replace words with casesensitive off sometimes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2495 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 2b6a4a6465..b52f7c6ca8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-08-13 Juergen Vigna + + * lyxfind.C (LyXReplace): fixed not single-replacing characters with + casesensitive off. + 2001-08-11 Dekel Tsur * Many files: Remove inherit_language, and add latex_language diff --git a/src/lyxfind.C b/src/lyxfind.C index 128949e3ec..34d1bfaebe 100644 --- a/src/lyxfind.C +++ b/src/lyxfind.C @@ -43,7 +43,7 @@ SearchResult SearchBackward(BufferView *, LyXText * text, string const & str, int LyXReplace(BufferView * bv, string const & searchstr, string const & replacestr, bool forward, bool casesens, bool matchwrd, bool replaceall, - bool once) + bool once) { if (!bv->available() || bv->buffer()->isReadonly()) return 0; @@ -76,14 +76,23 @@ int LyXReplace(BufferView * bv, // if nothing selected or selection does not equal search string // search and select next occurance and return if no replaceall - if (searchstr!=text->selectionAsString(bv->buffer())) { + string str1; + string str2; + if (casesens) { + str1 = searchstr; + str2 = text->selectionAsString(bv->buffer()); + } else { + str1 = lowercase(searchstr); + str2 = lowercase(text->selectionAsString(bv->buffer())); + } + if (str1 != str2) { if (!LyXFind(bv, searchstr, fw, false, casesens, matchwrd) || !replaceall) { return 0; } } - + bool found = false; int replace_count = 0; do { @@ -106,7 +115,7 @@ int LyXReplace(BufferView * bv, bool LyXFind(BufferView * bv, string const & searchstr, bool forward, - bool frominset, bool casesens, bool matchwrd) + bool frominset, bool casesens, bool matchwrd) { if (!bv->available() || searchstr.empty()) return false;