From 80f5cbb0a5d28dd31cae56979cbfeb96c49268a6 Mon Sep 17 00:00:00 2001 From: shatty Date: Thu, 7 Nov 2002 12:03:23 +0000 Subject: [PATCH] I think replace all is fixed now? git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1868 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/stylededit/StyledEditWindow.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/apps/stylededit/StyledEditWindow.cpp b/src/apps/stylededit/StyledEditWindow.cpp index c8c4f70463..993e548970 100644 --- a/src/apps/stylededit/StyledEditWindow.cpp +++ b/src/apps/stylededit/StyledEditWindow.cpp @@ -925,10 +925,24 @@ StyledEditWindow::ReplaceAll(BString findIt, BString replaceWith, bool caseSens) int32 oldstart; BString viewText(fTextView->Text()); + if (caseSens) + viewText.ReplaceAll(findIt.String(),replaceWith.String()); + else + viewText.IReplaceAll(findIt.String(),replaceWith.String()); + int32 textStart, textFinish; fTextView->GetSelection(&textStart, &textFinish); - // we search backwards because we are disturbing everything after the point we insert + fTextView->SetText(viewText.String()); + + if (viewText.Length() < textStart) + textStart = viewText.Length(); + if (viewText.Length() < textFinish) + textFinish = viewText.Length(); + + fTextView->Select(textStart,textFinish); + fTextView->ScrollToSelection(); +/* // we search backwards because we are disturbing everything after the point we insert start = viewText.Length(); while (start > 0) { oldstart = start; @@ -944,7 +958,7 @@ StyledEditWindow::ReplaceAll(BString findIt, BString replaceWith, bool caseSens) } else { start--; // we prefer not to get stuck } - } + } */ }/***StyledEditWindow::ReplaceAll()***/