{
VERIFY (CCrystalTextBuffer::DeleteText (pSource,
apparent_ptStartPos.y, apparent_ptStartPos.x, apparent_ptEndPos.y, apparent_ptEndPos.x,
- 0, TRUE, FALSE));
+ 0, FALSE));
ptCursorPos = apparent_ptStartPos;
}
else
int nEndLine, nEndChar;
VERIFY(CCrystalTextBuffer::InsertText (pSource,
apparent_ptStartPos.y, apparent_ptStartPos.x, ur.GetText (), nEndLine, nEndChar,
- 0, TRUE, FALSE));
+ 0, FALSE));
ptCursorPos = m_ptLastChange;
// for the flags, the logic is nearly the same as in insertText
{
int nEndLine, nEndChar;
VERIFY(InsertText (pSource, apparent_ptStartPos.y, apparent_ptStartPos.x,
- ur.GetText(), nEndLine, nEndChar, 0, TRUE, FALSE));
+ ur.GetText(), nEndLine, nEndChar, 0, FALSE));
ptCursorPos = m_ptLastChange;
}
else
ASSERT (lstrcmp (text, ur.GetText ()) == 0);
#endif
VERIFY(DeleteText(pSource, apparent_ptStartPos.y, apparent_ptStartPos.x,
- apparent_ptEndPos.y, apparent_ptEndPos.x, 0, TRUE, FALSE));
+ apparent_ptEndPos.y, apparent_ptEndPos.x, 0, FALSE));
ptCursorPos = apparent_ptStartPos;
}
m_nUndoPosition++;
BOOL CGhostTextBuffer::
InsertText (CCrystalTextView * pSource, int nLine, int nPos, LPCTSTR pszText,
- int &nEndLine, int &nEndChar, int nAction, BOOL bUpdate /*=TRUE*/, BOOL bHistory /*=TRUE*/)
+ int &nEndLine, int &nEndChar, int nAction, BOOL bHistory /*=TRUE*/)
{
BOOL bGroupFlag = FALSE;
if (bHistory)
}
}
- if (!CCrystalTextBuffer::InsertText (pSource, nLine, nPos, pszText, nEndLine, nEndChar, nAction, bUpdate, bHistory))
+ if (!CCrystalTextBuffer::InsertText (pSource, nLine, nPos, pszText, nEndLine, nEndChar, nAction, bHistory))
return FALSE;
// set WinMerge flags
RecomputeRealityMapping();
}
- RecomputeEOL (bUpdate? pSource:NULL, nLine, nEndLine);
+ RecomputeEOL (pSource, nLine, nEndLine);
if (bHistory == false)
BOOL CGhostTextBuffer::
DeleteText (CCrystalTextView * pSource, int nStartLine, int nStartChar,
- int nEndLine, int nEndChar, int nAction, BOOL bUpdate /*=TRUE*/, BOOL bHistory /*=TRUE*/)
+ int nEndLine, int nEndChar, int nAction, BOOL bHistory /*=TRUE*/)
{
BOOL bGroupFlag = FALSE;
if (bHistory)
CString sTextToDelete;
GetTextWithoutEmptys (nStartLine, nStartChar, nEndLine, nEndChar, sTextToDelete);
- if (!CCrystalTextBuffer::DeleteText (pSource, nStartLine, nStartChar, nEndLine, nEndChar, nAction, bUpdate, bHistory))
+ if (!CCrystalTextBuffer::DeleteText (pSource, nStartLine, nStartChar, nEndLine, nEndChar, nAction, bHistory))
return FALSE;
OnNotifyLineHasBeenEdited(nStartLine);
RecomputeRealityMapping();
}
- RecomputeEOL (bUpdate? pSource:NULL, nStartLine, nStartLine);
+ RecomputeEOL (pSource, nStartLine, nStartLine);
if (bHistory == false)
// Text modification functions
- virtual BOOL InsertText (CCrystalTextView * pSource, int nLine, int nPos, LPCTSTR pszText, int &nEndLine, int &nEndChar, int nAction = CE_ACTION_UNKNOWN, BOOL bUpdate =TRUE, BOOL bHistory =TRUE);
- virtual BOOL DeleteText (CCrystalTextView * pSource, int nStartLine, int nStartPos, int nEndLine, int nEndPos, int nAction = CE_ACTION_UNKNOWN, BOOL bUpdate =TRUE, BOOL bHistory =TRUE);
+ virtual BOOL InsertText (CCrystalTextView * pSource, int nLine, int nPos, LPCTSTR pszText, int &nEndLine, int &nEndChar, int nAction = CE_ACTION_UNKNOWN, BOOL bHistory =TRUE);
+ virtual BOOL DeleteText (CCrystalTextView * pSource, int nStartLine, int nStartPos, int nEndLine, int nEndPos, int nAction = CE_ACTION_UNKNOWN, BOOL bHistory =TRUE);
BOOL InsertGhostLine (CCrystalTextView * pSource, int nLine);
// Undo/Redo
// delete only on destination side since rescan will clear the other side
if(cd_blank==0)
{
- dbuf.DeleteText(curView, cd_blank, 0, cd_dend+1, 0, CE_ACTION_DELETE);
+ dbuf.DeleteText(curView, cd_blank, 0, cd_dend+1, 0, CE_ACTION_MERGE);
}
else
{
- dbuf.DeleteText(curView, cd_blank-1, dbuf.GetLineLength(cd_blank-1), cd_dend, dbuf.GetLineLength(cd_dend), CE_ACTION_DELETE);
+ dbuf.DeleteText(curView, cd_blank-1, dbuf.GetLineLength(cd_blank-1), cd_dend, dbuf.GetLineLength(cd_dend), CE_ACTION_MERGE);
}
deleted_lines=cd_dend-cd_blank+1;
// text exists on left side, so just replace
strLine = _T("");
sbuf.GetFullLine(i, strLine);
- dbuf.ReplaceFullLine(curView, i, strLine);
+ dbuf.ReplaceFullLine(curView, i, strLine, CE_ACTION_MERGE);
dbuf.FlushUndoGroup(curView);
dbuf.BeginUndoGroup(TRUE);
}
}
/// Replace text of line (no change to eol)
-void CMergeDoc::CDiffTextBuffer::ReplaceLine(CCrystalTextView * pSource, int nLine, const CString &strText)
+void CMergeDoc::CDiffTextBuffer::ReplaceLine(CCrystalTextView * pSource, int nLine, const CString &strText, int nAction /*=CE_ACTION_UNKNOWN*/)
{
if (GetLineLength(nLine)>0)
- DeleteText(pSource, nLine, 0, nLine, GetLineLength(nLine));
+ DeleteText(pSource, nLine, 0, nLine, GetLineLength(nLine), nAction);
int endl,endc;
if (! strText.IsEmpty())
- InsertText(pSource, nLine, 0, strText, endl,endc);
+ InsertText(pSource, nLine, 0, strText, endl,endc, nAction);
}
/// Return pointer to the eol chars of this string, or pointer to empty string if none
}
/// Replace line (removing any eol, and only including one if in strText)
-void CMergeDoc::CDiffTextBuffer::ReplaceFullLine(CCrystalTextView * pSource, int nLine, const CString &strText)
+void CMergeDoc::CDiffTextBuffer::ReplaceFullLine(CCrystalTextView * pSource, int nLine, const CString &strText, int nAction /*=CE_ACTION_UNKNOWN*/)
{
if (_tcscmp(GetLineEol(nLine), getEol(strText)) == 0)
{
// we must clean strText from its eol...
CString strTextWithoutEol = strText;
strTextWithoutEol.Delete(strTextWithoutEol.GetLength() - _tcslen(getEol(strTextWithoutEol)), 2);
- ReplaceLine(pSource, nLine, strTextWithoutEol);
+ ReplaceLine(pSource, nLine, strTextWithoutEol, nAction);
return;
}
- // we may need a last line to delete
+ // we may need a last line as the DeleteText end is (x=0,y=line+1)
if (nLine+1 == GetLineCount())
InsertGhostLine (pSource, GetLineCount());
if (GetFullLineLength(nLine))
- DeleteText(pSource, nLine, 0, nLine+1, 0);
+ DeleteText(pSource, nLine, 0, nLine+1, 0, nAction);
int endl,endc;
if (! strText.IsEmpty())
- InsertText(pSource, nLine, 0, strText, endl,endc);
+ InsertText(pSource, nLine, 0, strText, endl,endc, nAction);
}
/// Determine path for temporary files and init those files
#include "afxtempl.h"
#include "DiffWrapper.h"
+
+/**
+ * @brief additionnal action code for WinMerge (reserve 100 first codes for CrystalEdit)
+ */enum
+{
+ CE_ACTION_MERGE = 100,
+};
+
/**
* @brief Return statuses of file rescan
*/
+
enum
{
RESCAN_OK = 0,
virtual void AddUndoRecord (BOOL bInsert, const CPoint & ptStartPos, const CPoint & ptEndPos,
LPCTSTR pszText, int flags, int nActionType = CE_ACTION_UNKNOWN);
bool curUndoGroup();
- void ReplaceLine(CCrystalTextView * pSource, int nLine, const CString& strText);
- void ReplaceFullLine(CCrystalTextView * pSource, int nLine, const CString& strText);
+ void ReplaceLine(CCrystalTextView * pSource, int nLine, const CString& strText, int nAction =CE_ACTION_UNKNOWN);
+ void ReplaceFullLine(CCrystalTextView * pSource, int nLine, const CString& strText, int nAction =CE_ACTION_UNKNOWN);
BOOL LoadFromFile(LPCTSTR pszFileName, int nCrlfStyle = CRLF_STYLE_AUTOMATIC);
BOOL SaveToFile (LPCTSTR pszFileName, BOOL bTempFile,
if (!IsSelection ())
return FALSE;*/
+ m_pTextBuffer->BeginUndoGroup();
+
CPoint ptCursorPos;
if (IsSelection ())
{
SetCursorPos (ptCursorPos);
EnsureVisible (ptCursorPos);*/
- // [JRT]:
- m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_REPLACE, FALSE);
+ m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_REPLACE);
}
else
ptCursorPos = GetCursorPos ();
}
else
text.Empty ();
- m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, text, y, x, CE_ACTION_REPLACE, FALSE); // [JRT+FRD]
+ m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, text, y, x, CE_ACTION_REPLACE); // [JRT+FRD]
if (lpszNewStr)
free(lpszNewStr);
}
}
else
{
- m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszNewText, y, x, CE_ACTION_REPLACE, FALSE); // [JRT]
+ m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszNewText, y, x, CE_ACTION_REPLACE); // [JRT]
m_nLastReplaceLen = _tcslen (pszNewText);
}
+
+ m_pTextBuffer->FlushUndoGroup(this);
+
CPoint ptEndOfBlock = CPoint (x, y);
ASSERT_VALIDTEXTPOS (ptCursorPos);
ASSERT_VALIDTEXTPOS (ptEndOfBlock);
{
int nEndLine, nEndChar;
VERIFY(InsertText (pSource, apparent_ptStartPos.y, apparent_ptStartPos.x,
- ur.GetText(), nEndLine, nEndChar, 0, TRUE, FALSE));
+ ur.GetText(), nEndLine, nEndChar, 0, FALSE));
ptCursorPos = m_ptLastChange;
}
else
ASSERT (lstrcmp (text, ur.GetText ()) == 0);
#endif
VERIFY(DeleteText(pSource, apparent_ptStartPos.y, apparent_ptStartPos.x,
- apparent_ptEndPos.y, apparent_ptEndPos.x, 0, TRUE, FALSE));
+ apparent_ptEndPos.y, apparent_ptEndPos.x, 0, FALSE));
ptCursorPos = apparent_ptStartPos;
}
m_nUndoPosition++;
BOOL CCrystalTextBuffer::
InsertText (CCrystalTextView * pSource, int nLine, int nPos, LPCTSTR pszText,
- int &nEndLine, int &nEndChar, int nAction, BOOL bUpdate /*=TRUE*/, BOOL bHistory /*=TRUE*/)
+ int &nEndLine, int &nEndChar, int nAction, BOOL bHistory /*=TRUE*/)
{
- if (!InternalInsertText (bUpdate? pSource:NULL, nLine, nPos, pszText, nEndLine, nEndChar))
+ if (!InternalInsertText (pSource, nLine, nPos, pszText, nEndLine, nEndChar))
return FALSE;
if (bHistory == false)
BOOL CCrystalTextBuffer::
DeleteText (CCrystalTextView * pSource, int nStartLine, int nStartChar,
- int nEndLine, int nEndChar, int nAction, BOOL bUpdate /*=TRUE*/, BOOL bHistory /*=TRUE*/)
+ int nEndLine, int nEndChar, int nAction, BOOL bHistory /*=TRUE*/)
{
CString sTextToDelete;
GetTextWithoutEmptys (nStartLine, nStartChar, nEndLine, nEndChar, sTextToDelete);
- if (!InternalDeleteText (bUpdate? pSource:NULL, nStartLine, nStartChar, nEndLine, nEndChar))
+ if (!InternalDeleteText (pSource, nStartLine, nStartChar, nEndLine, nEndChar))
return FALSE;
if (bHistory == false)
void SetEolSensitivity(BOOL EolSensitive) { m_EolSensitive = EolSensitive; }
// Text modification functions
- virtual BOOL InsertText (CCrystalTextView * pSource, int nLine, int nPos, LPCTSTR pszText, int &nEndLine, int &nEndChar, int nAction = CE_ACTION_UNKNOWN, BOOL bUpdate =TRUE, BOOL bHistory =TRUE);
- virtual BOOL DeleteText (CCrystalTextView * pSource, int nStartLine, int nStartPos, int nEndLine, int nEndPos, int nAction = CE_ACTION_UNKNOWN, BOOL bUpdate =TRUE, BOOL bHistory =TRUE);
+ virtual BOOL InsertText (CCrystalTextView * pSource, int nLine, int nPos, LPCTSTR pszText, int &nEndLine, int &nEndChar, int nAction = CE_ACTION_UNKNOWN, BOOL bHistory =TRUE);
+ virtual BOOL DeleteText (CCrystalTextView * pSource, int nStartLine, int nStartPos, int nEndLine, int nEndPos, int nAction = CE_ACTION_UNKNOWN, BOOL bHistory =TRUE);
// Undo/Redo
BOOL CanUndo ();
2003-08-25 Laoran
+ [ 783507 ] normalize replaceSelection and ListCopy
+ WinMerge: GhostTextBuffer.cpp GhostTextBuffer.h MergeDoc.cpp MergeDoc.h
+ editlib : ccrystaleditview.cpp ccrystaltextbuffer.cpp ccrystaltextbuffer.h
+
+2003-08-25 Laoran
[ 794081 ] Error when dropping a column out of WinMerge
WinMerge: DirView.cpp