Index: unicode_far/stddlg.hpp
===================================================================
--- unicode_far/stddlg.hpp (revision 9550)
+++ unicode_far/stddlg.hpp (working copy)
@@ -82,6 +82,9 @@
Regexp
, "Regular expressions"
+ Regexp
+ , "Preserve style"
+
HelpTopic
.
nullptr - .
@@ -104,6 +107,7 @@
bool* WholeWords,
bool* Reverse,
bool* Regexp,
+ bool* PreserveStyle,
const wchar_t *HelpTopic=nullptr,
bool HideAll=false
);
Index: unicode_far/editor.hpp
===================================================================
--- unicode_far/editor.hpp (revision 9550)
+++ unicode_far/editor.hpp (working copy)
@@ -215,7 +215,7 @@
/* $ 30.07.2000 KM
"Whole words"
*/
- bool LastSearchCase,LastSearchWholeWords,LastSearchReverse, LastSearchRegexp;
+ bool LastSearchCase,LastSearchWholeWords,LastSearchReverse,LastSearchRegexp,LastSearchPreserveStyle;
uintptr_t m_codepage; //BUGBUG
Index: unicode_far/preservestyle.hpp
===================================================================
--- unicode_far/preservestyle.hpp (revision 0)
+++ unicode_far/preservestyle.hpp (working copy)
@@ -0,0 +1,3 @@
+#pragma once
+
+bool PreserveStyleReplaceString(const wchar_t *Source, int StrSize, const string& Str, string& ReplaceStr, int& CurPos, int Position, int Case, int WholeWords, const wchar_t *WordDiv, int Reverse, int& SearchLength);
Index: unicode_far/strmix.cpp
===================================================================
--- unicode_far/strmix.cpp (revision 9550)
+++ unicode_far/strmix.cpp (working copy)
@@ -39,6 +39,7 @@
#include "language.hpp"
#include "config.hpp"
#include "pathmix.hpp"
+#include "preservestyle.hpp"
string &FormatNumber(const wchar_t *Src, string &strDest, int NumDigits)
{
@@ -1381,13 +1382,16 @@
return (UuidFromString((unsigned short*)Value,&Guid)==RPC_S_OK)?true:false;
}
-bool SearchString(const wchar_t *Source, int StrSize, const string& Str, string& ReplaceStr,int& CurPos, int Position,int Case,int WholeWords,int Reverse,int Regexp, int *SearchLength,const wchar_t* WordDiv)
+bool SearchString(const wchar_t *Source, int StrSize, const string& Str, string& ReplaceStr,int& CurPos, int Position,int Case,int WholeWords,int Reverse,int Regexp,int PreserveStyle, int *SearchLength,const wchar_t* WordDiv)
{
*SearchLength = 0;
if (!WordDiv)
WordDiv=Global->Opt->strWordDiv;
+ if (!Regexp && PreserveStyle && PreserveStyleReplaceString(Source, StrSize, Str, ReplaceStr, CurPos, Position, Case, WholeWords, WordDiv, Reverse, *SearchLength))
+ return true;
+
if (Reverse)
{
Position--;
@@ -1467,6 +1471,17 @@
if (!Str[J])
{
CurPos=I;
+
+ // PreserveStyle: c PreserveStyleReplaceString,
+ // .
+ if (PreserveStyle && !ReplaceStr.IsEmpty() && IsAlpha(ReplaceStr[0]) && IsAlpha(Source[I]))
+ {
+ if (IsUpper(Source[I]))
+ ReplaceStr.GetBuffer()[0] = Upper(ReplaceStr[0]);
+ if (IsLower(Source[I]))
+ ReplaceStr.GetBuffer()[0] = Lower(ReplaceStr[0]);
+ }
+
return true;
}
Index: unicode_far/far.vc11.vcxproj.filters
===================================================================
--- unicode_far/far.vc11.vcxproj.filters (revision 9550)
+++ unicode_far/far.vc11.vcxproj.filters (working copy)
@@ -326,6 +326,9 @@
Source Files
+
+ Source Files
+
Source Files
@@ -853,6 +856,9 @@
Header Files
+
+ Header Files
+
Header Files
Index: unicode_far/makefile_gcc
===================================================================
--- unicode_far/makefile_gcc (revision 9550)
+++ unicode_far/makefile_gcc (working copy)
@@ -108,6 +108,7 @@
plugins.cpp \
plugsettings.cpp \
poscache.cpp \
+ preservestyle.cpp \
print.cpp \
privilege.cpp \
processname.cpp \
Index: unicode_far/help.cpp
===================================================================
--- unicode_far/help.cpp (revision 9550)
+++ unicode_far/help.cpp (working copy)
@@ -1339,7 +1339,7 @@
string strTempStr;
//int RetCode = GetString(MSG(MHelpSearchTitle),MSG(MHelpSearchingFor),L"HelpSearch",strLastSearchStr,strLastSearchStr0);
- int RetCode = GetSearchReplaceString(false, MSG(MHelpSearchTitle), MSG(MHelpSearchingFor), strLastSearchStr0, strTempStr, L"HelpSearch", L"", &Case, &WholeWords, nullptr, &Regexp,nullptr,true);
+ int RetCode = GetSearchReplaceString(false, MSG(MHelpSearchTitle), MSG(MHelpSearchingFor), strLastSearchStr0, strTempStr, L"HelpSearch", L"", &Case, &WholeWords, nullptr, &Regexp, nullptr, nullptr, true);
if (RetCode <= 0)
return TRUE;
@@ -1908,7 +1908,7 @@
string ReplaceStr;
int CurPos=0;
int SearchLength;
- bool Result=SearchString(strReadStr,(int)strReadStr.GetLength(),strLastSearchStr,ReplaceStr,CurPos,0,LastSearchCase,LastSearchWholeWords,false,LastSearchRegexp,&SearchLength);
+ bool Result=SearchString(strReadStr,(int)strReadStr.GetLength(),strLastSearchStr,ReplaceStr,CurPos,0,LastSearchCase,LastSearchWholeWords,false,false,LastSearchRegexp,&SearchLength);
if (Result)
{
Index: unicode_far/makefile_vc
===================================================================
--- unicode_far/makefile_vc (revision 9550)
+++ unicode_far/makefile_vc (working copy)
@@ -200,6 +200,7 @@
"$(INTDIR)\plugins.obj" \
"$(INTDIR)\plugsettings.obj" \
"$(INTDIR)\poscache.obj" \
+ "$(INTDIR)\preservestyle.obj" \
"$(INTDIR)\print.obj" \
"$(INTDIR)\privilege.obj" \
"$(INTDIR)\processname.obj" \
Index: unicode_far/strmix.hpp
===================================================================
--- unicode_far/strmix.hpp (revision 9550)
+++ unicode_far/strmix.hpp (working copy)
@@ -123,4 +123,4 @@
string GuidToStr(const GUID& Guid);
bool StrToGuid(const wchar_t* Value,GUID& Guid);
-bool SearchString(const wchar_t *Source, int StrSize, const string& Str, string& ReplaceStr,int& CurPos, int Position,int Case,int WholeWords,int Reverse,int Regexp, int *SearchLength,const wchar_t* WordDiv=nullptr);
+bool SearchString(const wchar_t *Source, int StrSize, const string& Str, string& ReplaceStr,int& CurPos, int Position,int Case,int WholeWords,int Reverse,int Regexp,int PreserveStyle, int *SearchLength,const wchar_t* WordDiv=nullptr);
Index: unicode_far/farlang.templ.m4
===================================================================
--- unicode_far/farlang.templ.m4 (revision 9550)
+++ unicode_far/farlang.templ.m4 (working copy)
@@ -4988,6 +4988,16 @@
"Expresiones re&gulares"
"Re&gulárne výrazy"
+MEditSearchPreserveStyle
+"&Сохранять стиль"
+"&Preserve style"
+upd:"&Zachovat styl"
+upd:"&Preserve Stil"
+upd:"&Megőrzése stílus"
+upd:"&Zachowaj styl"
+upd:"&Preservar estilo"
+upd:"&Zachovať štýl"
+
MEditSearchSearch
"Искать"
"Search"
Index: unicode_far/far.vcxproj
===================================================================
--- unicode_far/far.vcxproj (revision 9550)
+++ unicode_far/far.vcxproj (working copy)
@@ -568,6 +568,7 @@
+
Index: unicode_far/edit.cpp
===================================================================
--- unicode_far/edit.cpp (revision 9550)
+++ unicode_far/edit.cpp (working copy)
@@ -2097,7 +2097,7 @@
-
.
*/
-int Edit::Search(const string& Str,string& ReplaceStr,int Position,int Case,int WholeWords,int Reverse,int Regexp, int *SearchLength)
+int Edit::Search(const string& Str,string& ReplaceStr,int Position,int Case,int WholeWords,int Reverse,int Regexp,int PreserveStyle, int *SearchLength)
{
#if 0
*SearchLength = 0;
@@ -2226,7 +2226,7 @@
return FALSE;
#else
- return SearchString(this->Str,this->StrSize,Str,ReplaceStr,CurPos,Position,Case,WholeWords,Reverse,Regexp,SearchLength,WordDiv());
+ return SearchString(this->Str,this->StrSize,Str,ReplaceStr,CurPos,Position,Case,WholeWords,Reverse,Regexp,PreserveStyle,SearchLength,WordDiv());
#endif
}
Index: unicode_far/far.vc11.vcxproj
===================================================================
--- unicode_far/far.vc11.vcxproj (revision 9550)
+++ unicode_far/far.vc11.vcxproj (working copy)
@@ -425,6 +425,7 @@
+
@@ -816,6 +817,7 @@
+
Index: unicode_far/contrib/codeblocks/Far.cbp
===================================================================
--- unicode_far/contrib/codeblocks/Far.cbp (revision 9550)
+++ unicode_far/contrib/codeblocks/Far.cbp (working copy)
@@ -328,6 +328,8 @@
+
+
Index: unicode_far/stddlg.cpp
===================================================================
--- unicode_far/stddlg.cpp (revision 9550)
+++ unicode_far/stddlg.cpp (working copy)
@@ -59,6 +59,7 @@
bool* pWholeWords,
bool* pReverse,
bool* pRegexp,
+ bool* pPreserveStyle,
const wchar_t *HelpTopic,
bool HideAll)
{
@@ -81,6 +82,7 @@
bool WholeWords=pWholeWords?*pWholeWords:false;
bool Reverse=pReverse?*pReverse:false;
bool Regexp=pRegexp?*pRegexp:false;
+ bool PreserveStyle=pPreserveStyle?*pPreserveStyle:false;
if (IsReplaceMode)
@@ -96,7 +98,7 @@
05 | |
06 +--------------------------------------------------------------------+
07 | [ ] Case sensitive [ ] Regular expressions |
- 08 | [ ] Whole words |
+ 08 | [ ] Whole words [ ] Preserve style |
09 | [ ] Reverse search |
10 +--------------------------------------------------------------------+
11 | [ Replace ] [ Cancel ] |
@@ -115,6 +117,7 @@
{DI_CHECKBOX,5,8,0,8,WholeWords,nullptr,nullptr,0,MSG(MEditSearchWholeWords)},
{DI_CHECKBOX,5,9,0,9,Reverse,nullptr,nullptr,0,MSG(MEditSearchReverse)},
{DI_CHECKBOX,40,7,0,7,Regexp,nullptr,nullptr,0,MSG(MEditSearchRegexp)},
+ {DI_CHECKBOX,40,8,0,8,PreserveStyle,nullptr,nullptr,0,MSG(MEditSearchPreserveStyle)},
{DI_TEXT,-1,10,0,10,0,nullptr,nullptr,DIF_SEPARATOR,L""},
{DI_BUTTON,0,11,0,11,0,nullptr,nullptr,DIF_DEFAULTBUTTON|DIF_CENTERGROUP,MSG(MEditReplaceReplace)},
{DI_BUTTON,0,11,0,11,0,nullptr,nullptr,DIF_CENTERGROUP,MSG(MEditSearchCancel)},
@@ -129,6 +132,8 @@
ReplaceDlg[8].Flags |= DIF_DISABLE; // DIF_HIDDEN ??
if (!pRegexp)
ReplaceDlg[9].Flags |= DIF_DISABLE; // DIF_HIDDEN ??
+ if (!pPreserveStyle)
+ ReplaceDlg[10].Flags |= DIF_DISABLE; // DIF_HIDDEN ??
Dialog Dlg(ReplaceDlg,ARRAYSIZE(ReplaceDlgData));
Dlg.SetPosition(-1,-1,76,14);
@@ -138,7 +143,7 @@
Dlg.Process();
- if(Dlg.GetExitCode() == 11)
+ if(Dlg.GetExitCode() == 12)
{
Result = 1;
SearchStr = ReplaceDlg[2].strData;
@@ -147,6 +152,7 @@
WholeWords=ReplaceDlg[7].Selected == BSTATE_CHECKED;
Reverse=ReplaceDlg[8].Selected == BSTATE_CHECKED;
Regexp=ReplaceDlg[9].Selected == BSTATE_CHECKED;
+ PreserveStyle=ReplaceDlg[10].Selected == BSTATE_CHECKED;
}
}
else
@@ -223,6 +229,8 @@
*pReverse=Reverse;
if (pRegexp)
*pRegexp=Regexp;
+ if (pPreserveStyle)
+ *pPreserveStyle=PreserveStyle;
return Result;
}
Index: unicode_far/editor.cpp
===================================================================
--- unicode_far/editor.cpp (revision 9550)
+++ unicode_far/editor.cpp (working copy)
@@ -88,6 +88,7 @@
LastSearchWholeWords(Global->GlobalSearchWholeWords),
LastSearchReverse(Global->GlobalSearchReverse),
LastSearchRegexp(Global->Opt->EdOpt.SearchRegexp),
+ LastSearchPreserveStyle(false),
m_codepage(CP_DEFAULT),
StartLine(-1),
StartChar(-1),
@@ -3681,7 +3682,7 @@
string strMsgStr;
const wchar_t *TextHistoryName=L"SearchText",*ReplaceHistoryName=L"ReplaceText";
int CurPos, NewNumLine;
- bool Case,WholeWords,ReverseSearch,Regexp,Match,UserBreak;
+ bool Case,WholeWords,ReverseSearch,Regexp,PreserveStyle,Match,UserBreak;
AutoUndoBlock UndoBlock(this);
if (Next && strLastSearchStr.IsEmpty())
@@ -3692,6 +3693,7 @@
Case=LastSearchCase;
WholeWords=LastSearchWholeWords;
ReverseSearch=LastSearchReverse;
+ PreserveStyle=LastSearchPreserveStyle;
Regexp=LastSearchRegexp;
bool FindAllReferences = false;
@@ -3710,7 +3712,7 @@
}
}
- int DlgResult = GetSearchReplaceString(ReplaceMode, nullptr, nullptr, strSearchStr, strReplaceStr, TextHistoryName, ReplaceHistoryName, &Case, &WholeWords, &ReverseSearch, &Regexp, L"EditorSearch");
+ int DlgResult = GetSearchReplaceString(ReplaceMode, nullptr, nullptr, strSearchStr, strReplaceStr, TextHistoryName, ReplaceHistoryName, &Case, &WholeWords, &ReverseSearch, &Regexp, &PreserveStyle, L"EditorSearch");
if (!DlgResult)
{
return FALSE;
@@ -3727,6 +3729,7 @@
LastSearchWholeWords=WholeWords;
LastSearchReverse=ReverseSearch;
LastSearchRegexp=Regexp;
+ LastSearchPreserveStyle=PreserveStyle;
if(FindAllReferences)
{
@@ -3808,7 +3811,7 @@
int SearchLength=0;
string strReplaceStrCurrent(ReplaceMode?strReplaceStr:L"");
- if (CurPtr->Search(strSearchStr,strReplaceStrCurrent,CurPos,Case,WholeWords,ReverseSearch,Regexp,&SearchLength))
+ if (CurPtr->Search(strSearchStr,strReplaceStrCurrent,CurPos,Case,WholeWords,ReverseSearch,Regexp,PreserveStyle,&SearchLength))
{
Match=1;
Edit *FoundPtr = CurPtr;
Index: unicode_far/mkdep.list
===================================================================
--- unicode_far/mkdep.list (revision 9550)
+++ unicode_far/mkdep.list (working copy)
@@ -209,6 +209,8 @@
plugsettings.hpp
poscache.cpp
poscache.hpp
+preservestyle.cpp
+preservestyle.hpp
print.cpp
print.hpp
privilege.cpp
Index: unicode_far/preservestyle.cpp
===================================================================
--- unicode_far/preservestyle.cpp (revision 0)
+++ unicode_far/preservestyle.cpp (working copy)
@@ -0,0 +1,326 @@
+#include "headers.hpp"
+#pragma hdrstop
+
+#include "preservestyle.hpp"
+
+static const wchar_t *PreserveStyleTokenSeparators = L"_-.";
+
+enum PreserveStyleType
+{
+ UPPERCASE_ALL,
+ LOWERCASE_ALL,
+ UPPERCASE_FIRST,
+ UNKNOWN
+};
+
+struct PreserveStyleToken
+{
+ string Token;
+ wchar_t PrependChar;
+ int TypeMask;
+};
+
+static inline bool IsPreserveStyleTokenSeparator(wchar_t C)
+{
+ return wcschr(PreserveStyleTokenSeparators, C) != 0;
+}
+
+static int GetPeserveCaseStyleMask(const string& strStr)
+{
+ int Result = 15;
+
+ for (size_t I = 0; I < strStr.GetLength(); I++)
+ {
+ int Upper = IsUpper(strStr[I]);
+ int Lower = IsLower(strStr[I]);
+ if (!Upper)
+ Result &= ~(1 << UPPERCASE_ALL);
+ if (!Lower)
+ Result &= ~(1 << LOWERCASE_ALL);
+ if ((!Upper || !IsAlpha(strStr[I])) && I == 0)
+ Result &= ~(1 << UPPERCASE_FIRST);
+ if (!Lower && I > 0)
+ Result &= ~(1 << UPPERCASE_FIRST);
+ }
+
+ return Result;
+}
+
+static std::vector InternalPreserveStyleTokenize(const string& strStr, int From, int Length)
+{
+ std::vector Result;
+
+ wchar_t Sep = 0;
+ std::vector Seps(Length, false);
+ for (int I = From+1; I+1 < From+Length; I++)
+ if (IsPreserveStyleTokenSeparator(strStr[I])
+ && !IsPreserveStyleTokenSeparator(strStr[I-1])
+ && !IsPreserveStyleTokenSeparator(strStr[I+1]))
+ {
+ if (Sep != 0 && strStr[I] != Sep)
+ {
+ PreserveStyleToken T;
+ T.Token = strStr.SubStr(From, Length);
+ T.PrependChar = 0;
+ T.TypeMask = 1 << UNKNOWN;
+ Result.push_back(T);
+ return Result;
+ }
+
+ Seps[I-From] = true;
+ }
+
+ int L = From;
+ for (int I = From+1; I < From+Length; I++)
+ {
+ if (Seps[I-From])
+ {
+ PreserveStyleToken T;
+ T.Token = strStr.SubStr(L, I-L);
+ T.PrependChar = 0;
+ if (L-1-From >= 0 && Seps[L-1-From])
+ T.PrependChar = strStr[L-1];
+ Result.push_back(T);
+ L = I+1;
+ I++;
+ continue;
+ }
+
+ if (!Seps[I-From-1] && IsLower(strStr[I-1]) && IsUpper(strStr[I]))
+ {
+ PreserveStyleToken T;
+ T.Token = strStr.SubStr(L, I-L);
+ T.PrependChar = 0;
+ if (L-1-From >= 0 && Seps[L-1-From])
+ T.PrependChar = strStr[L-1];
+ Result.push_back(T);
+ L = I;
+ }
+ }
+
+ if (L < From+Length)
+ {
+ PreserveStyleToken T;
+ T.Token = strStr.SubStr(L, From+Length-L);
+ T.PrependChar = 0;
+ if (L-1-From >= 0 && Seps[L-1-From])
+ T.PrependChar = strStr[L-1];
+ Result.push_back(T);
+ }
+
+ if (Result.size() > 1)
+ {
+ wchar_t PrependChar = Result[1].PrependChar;
+ for (size_t I = 2; I < Result.size(); I++)
+ if (PrependChar != Result[I].PrependChar)
+ {
+ Result.clear();
+ PreserveStyleToken T;
+ T.Token = strStr.SubStr(From, Length);
+ T.PrependChar = 0;
+ T.TypeMask = 1 << UNKNOWN;
+ Result.push_back(T);
+ return Result;
+ }
+ }
+
+ return Result;
+}
+
+static std::vector PreserveStyleTokenize(const string& strStr, int From, int Length)
+{
+ std::vector Tokens = InternalPreserveStyleTokenize(strStr, From, Length);
+
+ int Mask = -1;
+ for (size_t I = 0; I < Tokens.size(); I++)
+ {
+ if (I == 0)
+ Tokens[I].TypeMask = GetPeserveCaseStyleMask(Tokens[I].Token);
+ else
+ {
+ if (Mask == -1)
+ Mask = GetPeserveCaseStyleMask(Tokens[I].Token);
+ else
+ Mask &= GetPeserveCaseStyleMask(Tokens[I].Token);
+ }
+ }
+
+ for (size_t I = 1; I < Tokens.size(); I++)
+ Tokens[I].TypeMask = Mask;
+
+ return Tokens;
+}
+
+static void ToPreserveStyleType(string& strStr, PreserveStyleType type)
+{
+ if (type != UNKNOWN)
+ {
+ for (size_t I = 0; I < strStr.GetLength(); I++)
+ {
+ if (type == UPPERCASE_ALL)
+ strStr.GetBuffer()[I] = Upper(strStr[I]);
+ if (type == LOWERCASE_ALL)
+ strStr.GetBuffer()[I] = Lower(strStr[I]);
+ if (type == UPPERCASE_FIRST)
+ {
+ if (I == 0)
+ strStr.GetBuffer()[I] = Upper(strStr[I]);
+ else
+ strStr.GetBuffer()[I] = Lower(strStr[I]);
+ }
+ }
+ }
+}
+
+static PreserveStyleType ChoosePreserveStyleType(int Mask)
+{
+ if (Mask == (1 << UNKNOWN))
+ return UNKNOWN;
+
+ PreserveStyleType Result = UNKNOWN;
+ for (int Style = 0; UPPERCASE_ALL+Style < UNKNOWN; Style++)
+ if ((Mask & (1 << Style)) != 0)
+ Result = PreserveStyleType(UPPERCASE_ALL+Style);
+
+ return Result;
+}
+
+bool PreserveStyleReplaceString(const wchar_t *Source, int StrSize, const string& Str, string& ReplaceStr, int& CurPos, int Position, int Case, int WholeWords, const wchar_t *WordDiv, int Reverse, int& SearchLength)
+{
+ SearchLength = 0;
+
+ if (Reverse)
+ {
+ Position--;
+
+ if (Position>=StrSize)
+ Position=StrSize-1;
+
+ if (Position<0)
+ return false;
+ }
+
+ if (Position>=StrSize || Str.IsEmpty() || ReplaceStr.IsEmpty())
+ return false;
+
+
+ std::vector StrTokens = PreserveStyleTokenize(Str, 0, Str.GetLength());
+
+ for (int I=Position; (Reverse && I>=0) || (!Reverse && I= StrTokens[J].Token.GetLength())
+ {
+ Matched = false;
+ break;
+ }
+
+ if (Case && Source[Idx] != StrTokens[J].Token[T])
+ {
+ Matched = false;
+ break;
+ }
+
+ if (!Case && Upper(Source[Idx]) != Upper(StrTokens[J].Token[T]))
+ {
+ Matched = false;
+ break;
+ }
+
+ T++;
+ Idx++;
+ }
+
+ if (WholeWords && !(Idx >= StrSize || IsSpace(Source[Idx]) || wcschr(WordDiv, Source[Idx])))
+ continue;
+
+ if (Matched && T == StrTokens[J].Token.GetLength() && J+1 == StrTokens.size())
+ {
+ std::vector SourceTokens = PreserveStyleTokenize(Source, I, Idx-I);
+
+ bool Same = SourceTokens.size() == StrTokens.size();
+ for (size_t K = 0; Same && K < SourceTokens.size(); K++)
+ Same &= SourceTokens[K].Token.GetLength() == StrTokens[K].Token.GetLength();
+
+ if (Same)
+ {
+ std::vector ReplaceStrTokens = PreserveStyleTokenize(ReplaceStr, 0, ReplaceStr.GetLength());
+ ToPreserveStyleType(ReplaceStrTokens[0].Token, ChoosePreserveStyleType(SourceTokens[0].TypeMask));
+ ReplaceStrTokens[0].PrependChar = SourceTokens[0].PrependChar;
+
+ int Last = SourceTokens.size()-1;
+ if (Last > 0)
+ for (size_t K = 1; K < ReplaceStrTokens.size(); K++)
+ {
+ ToPreserveStyleType(ReplaceStrTokens[K].Token, ChoosePreserveStyleType(SourceTokens[Last].TypeMask));
+ ReplaceStrTokens[K].PrependChar = SourceTokens[Last].PrependChar;
+ }
+
+ ReplaceStr = "";
+ for (size_t K = 0; K < ReplaceStrTokens.size(); K++)
+ {
+ if (ReplaceStrTokens[K].PrependChar != 0)
+ ReplaceStr += ReplaceStrTokens[K].PrependChar;
+ ReplaceStr += ReplaceStrTokens[K].Token;
+ }
+
+ CurPos = I;
+ SearchLength = Idx-I;
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
Index: unicode_far/edit.hpp
===================================================================
--- unicode_far/edit.hpp (revision 9550)
+++ unicode_far/edit.hpp (working copy)
@@ -113,7 +113,7 @@
void AppendString(const wchar_t *Str);
void InsertString(const wchar_t *Str);
void InsertBinaryString(const wchar_t *Str,int Length);
- int Search(const string& Str,string& ReplaceStr,int Position,int Case,int WholeWords,int Reverse,int Regexp, int *SearchLength);
+ int Search(const string& Str,string& ReplaceStr,int Position,int Case,int WholeWords,int Reverse,int Regexp,int PreserveStyle, int *SearchLength);
void SetClearFlag(bool Flag) {Flags.Change(FEDITLINE_CLEARFLAG,Flag);}
int GetClearFlag() {return Flags.Check(FEDITLINE_CLEARFLAG);}
void SetCurPos(int NewPos) {CurPos=NewPos; SetPrevCurPos(NewPos);}
Index: unicode_far/far.vcxproj.filters
===================================================================
--- unicode_far/far.vcxproj.filters (revision 9550)
+++ unicode_far/far.vcxproj.filters (working copy)
@@ -326,6 +326,9 @@
Source Files
+
+ Source Files
+
Source Files
@@ -853,6 +856,9 @@
Header Files
+
+ Header Files
+
Header Files