* @return true if succeeded.
*/
bool CCrystalEditView::
-ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags)
+ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags, bool bGroupWithPrevious)
{
if (!cchNewText)
return DeleteCurrentSelection();
ASSERT (pszNewText != nullptr);
- m_pTextBuffer->BeginUndoGroup();
+ m_pTextBuffer->BeginUndoGroup(bGroupWithPrevious);
CPoint ptCursorPos;
if (IsSelection ())
virtual bool QueryEditable ();
virtual void UpdateView (CCrystalTextView * pSource, CUpdateContext * pContext, DWORD dwFlags, int nLineIndex = -1) override;
- bool ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags);
+ bool ReplaceSelection (LPCTSTR pszNewText, size_t cchNewText, DWORD dwFlags, bool bGroupWithPrevious = false);
virtual void OnEditOperation (int nAction, LPCTSTR pszText, size_t cchText) override;
}
CPoint m_ptFirstFound = m_ptFoundAt;
+ bool bGroupWithPrevious = false;
while (m_bFound)
{
dwSearchFlags |= FIND_REGEXP;
// We have highlighted text
- VERIFY (m_pBuddy->ReplaceSelection (m_sNewText, m_sNewText.GetLength(), dwSearchFlags));
+ VERIFY (m_pBuddy->ReplaceSelection (m_sNewText, m_sNewText.GetLength(), dwSearchFlags, bGroupWithPrevious));
// Manually recalculate points
if (m_bEnableScopeSelection)
if (bWrapped)
if (m_ptFoundAt.y > m_ptFirstFound.y || (m_ptFoundAt.y == m_ptFirstFound.y && m_ptFoundAt.x >= m_ptFirstFound.x))
break;
+
+ bGroupWithPrevious = true;
}
// Let user know how many strings were replaced