Compared files  

Left
C:\SDK\wxWidgets-2.6.2\contrib\src\stc\scintilla\src\Document.cxx
Last modified2005-03-21 12:17:52.000 +0100
Size38 Kb (1478 Lines)
EncodingLatin 1 - ANSI (CP1252) default
Right
C:\SDK\wxWidgets-2.6.3\contrib\src\stc\scintilla\src\Document.cxx
Last modified2006-03-16 13:07:04.000 +0100
Size40.5 Kb (1594 Lines)
EncodingLatin 1 - ANSI (CP1252) default


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged501361
Inserted1498
Deleted415
Ignored00
Changed31237



   Comparison Details  

102 skipped lines
103U103U 
104U104Uint Document::AddMark(int line, int markerNum) {
105U105U    int prev = cb.AddMark(line, markerNum);
106C    DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); 106C    DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
  107C    mh.line = line;
107U108U    NotifyModified(mh);
108U109U    return prev;
109U110U}
110U111U 
  112Avoid Document::AddMarkSet(int line, int valueSet) {
  113A    unsigned int m = valueSet;
  114A    for (int i = 0; m; i++, m >>= 1)
  115A        if (m & 1)
  116A        cb.AddMark(line, i);
  117A    DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
  118A    mh.line = line;
  119A    NotifyModified(mh);
  120A}
  121A 
111U122Uvoid Document::DeleteMark(int line, int markerNum) {
112U123U    cb.DeleteMark(line, markerNum);
113C    DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); 124C    DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
  125C    mh.line = line;
114U126U    NotifyModified(mh);
115U127U}
116U128U 
117U129Uvoid Document::DeleteMarkFromHandle(int markerHandle) {
118U130U    cb.DeleteMarkFromHandle(markerHandle);
119U131U    DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
  132A    mh.line = -1;
120U133U    NotifyModified(mh);
121U134U}
122U135U 
123U136Uvoid Document::DeleteAllMarks(int markerNum) {
124U137U    cb.DeleteAllMarks(markerNum);
125U138U    DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
  139A    mh.line = -1;
126U140U    NotifyModified(mh);
127U141U}
128U142U 
137 skipped lines
266U280U        return 1;
267U281U    }
268U282U}
269C#include <assert.h> 283C 
270U284U// Normalise a position so that it is not halfway through a two byte character.
271U285U// This can occur in two situations -
272U286U// When lines are terminated with \r\n pairs which should be treated as one character.
7 skipped lines
280U294U    if (pos >= Length())
281U295U        return Length();
282U296U 
283C    // asserpos > 0 && pos < Length() 297C    // PLATFORM_ASSERT(pos > 0 && pos < Length());
284U298U    if (checkLineEnd && IsCrLf(pos - 1)) {
285U299U        if (moveDir > 0)
286U300U        return pos + 1;
49 skipped lines
336U350U        endStyled = pos;
337U351U}
338U352U 
  353Avoid Document::CheckReadOnly() {
  354A    if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
  355A        enteredReadOnlyCount++;
  356A        NotifyModifyAttempt();
  357A        enteredReadOnlyCount--;
  358A    }
  359A}
  360A 
339U361U// Document only modified by gateways DeleteChars, InsertStyledString, Undo, Redo, and SetStyleAt.
340U362U// SetStyleAt does not change the persistent state of a document
341U363U 
3 skipped lines
345U367U        return false;
346U368U    if ((pos + len) > Length())
347U369U        return false;
348C    if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { 370C    CheckReadOnly();
349C        enteredReadOnlyCount++;  
350C        NotifyModifyAttempt();  
351C        enteredReadOnlyCount--;  
352C    }  
353U371U    if (enteredCount != 0) {
354U372U        return false;
355U373U    } else {
28 skipped lines
384U402U * Insert a styled string (char/style pairs) with a length.
385U403U */
386U404Ubool Document::InsertStyledString(int position, char *s, int insertLength) {
387C    if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { 405C    CheckReadOnly();
388C        enteredReadOnlyCount++;  
389C        NotifyModifyAttempt();  
390C        enteredReadOnlyCount--;  
391C    }  
392U406U    if (enteredCount != 0) {
393U407U        return false;
394U408U    } else {
22 skipped lines
417U431U}
418U432U 
419U433Uint Document::Undo() {
420C    int newPos = 0; 434C    int newPos = -1;
  435C    CheckReadOnly();
421U436U    if (enteredCount == 0) {
422U437U        enteredCount++;
  438C        if (!cb.IsReadOnly()) {
423C        bool startSavePoint = cb.IsSavePoint(); 439C        bool startSavePoint = cb.IsSavePoint();
  440C        bool multiLine = false;
424C        int steps = cb.StartUndo(); 441C        int steps = cb.StartUndo();
425C        //Platform::DebugPrintf("Steps=%d\n", steps); 442C        //Platform::DebugPrintf("Steps=%d\n", steps);
426C        for (int step = 0; step < steps; step++) { 443C        for (int step = 0; step < steps; step++) {
427C        int prevLinesTotal = LinesTotal(); 444C        consint prevLinesTotal = LinesTotal();
428C        const Action &action = cb.GetUndoStep(); 445C        const Action &action = cb.GetUndoStep();
429C        if (action.at == removeAction) { 446C        if (action.at == removeAction) {
430C        NotifyModified(DocModification( 447C        NotifyModified(DocModification(
431C                           SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); 448C        SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
432C        } else { 449C        } else {
433C        NotifyModified(DocModification( 450C        NotifyModified(DocModification(
434C                           SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); 451C        SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
435C        } 452C        }
436C        cb.PerformUndoStep(); 453C        cb.PerformUndoStep();
437C        int cellPosition = action.position / 2; 454C        int cellPosition = action.position;
438C        ModifiedAt(cellPosition); 455C        ModifiedAt(cellPosition);
439C        newPos = cellPosition; 456C        newPos = cellPosition;
440U457U 
441C        int modFlags = SC_PERFORMED_UNDO; 458C        int modFlags = SC_PERFORMED_UNDO;
442C        // With undo, an insertion action becomes a deletion notification 459C        // With undo, an insertion action becomes a deletion notification
443C        if (action.at == removeAction) { 460C        if (action.at == removeAction) {
444C        newPos += action.lenData; 461C        newPos += action.lenData;
445C        modFlags |= SC_MOD_INSERTTEXT; 462C        modFlags |= SC_MOD_INSERTTEXT;
446C        } else { 463C        } else {
447C        modFlags |= SC_MOD_DELETETEXT; 464C        modFlags |= SC_MOD_DELETETEXT;
  465C        }
  466C        if (steps > 1)
  467C        modFlags |= SC_MULTISTEPUNDOREDO;
  468C        const int linesAdded = LinesTotal() - prevLinesTotal;
  469C        if (linesAdded != 0)
  470C        multiLine = true;
  471C        if (step == steps - 1) {
  472C        modFlags |= SC_LASTSTEPINUNDOREDO;
  473C        if (multiLine)
  474C        modFlags |= SC_MULTILINEUNDOREDO;
  475C        }
  476C        NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
  477C           linesAdded, action.data));
448U478U        }
449R        if (step == steps - 1)  
450R        modFlags |= SC_LASTSTEPINUNDOREDO;  
451R        NotifyModified(DocModification(modFlags, cellPosition, action.lenData,  
452R                                       LinesTotal() - prevLinesTotal, action.data));  
453R        }  
454U479U 
455C        bool endSavePoint = cb.IsSavePoint(); 480C        bool endSavePoint = cb.IsSavePoint();
456C        if (startSavePoint != endSavePoint) 481C        if (startSavePoint != endSavePoint)
457C        NotifySavePoint(endSavePoint); 482C        NotifySavePoint(endSavePoint);
  483C        }
458U484U        enteredCount--;
459U485U    }
460U486U    return newPos;
461U487U}
462U488U 
463U489Uint Document::Redo() {
464C    int newPos = 0; 490C    int newPos = -1;
  491C    CheckReadOnly();
465U492U    if (enteredCount == 0) {
466U493U        enteredCount++;
  494C        if (!cb.IsReadOnly()) {
467C        bool startSavePoint = cb.IsSavePoint(); 495C        bool startSavePoint = cb.IsSavePoint();
  496C        bool multiLine = false;
468C        int steps = cb.StartRedo(); 497C        int steps = cb.StartRedo();
469C        for (int step = 0; step < steps; step++) { 498C        for (int step = 0; step < steps; step++) {
470C        int prevLinesTotal = LinesTotal(); 499C        consint prevLinesTotal = LinesTotal();
471C        const Action &action = cb.GetRedoStep(); 500C        const Action &action = cb.GetRedoStep();
472C        if (action.at == insertAction) { 501C        if (action.at == insertAction) {
473C        NotifyModified(DocModification( 502C        NotifyModified(DocModification(
474C                           SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); 503C        SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
475C        } else { 504C        } else {
476C        NotifyModified(DocModification( 505C        NotifyModified(DocModification(
477C                           SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); 506C        SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
478C        } 507C        }
479C        cb.PerformRedoStep(); 508C        cb.PerformRedoStep();
480C        ModifiedAt(action.position / 2); 509C        ModifiedAt(action.position);
481C        newPos = action.position / 2; 510C        newPos = action.position;
482U511U 
483C        int modFlags = SC_PERFORMED_REDO; 512C        int modFlags = SC_PERFORMED_REDO;
484C        if (action.at == insertAction) { 513C        if (action.at == insertAction) {
485C        newPos += action.lenData; 514C        newPos += action.lenData;
486C        modFlags |= SC_MOD_INSERTTEXT; 515C        modFlags |= SC_MOD_INSERTTEXT;
487C        } else { 516C        } else {
488C        modFlags |= SC_MOD_DELETETEXT; 517C        modFlags |= SC_MOD_DELETETEXT;
  518C        }
  519C        if (steps > 1)
  520C        modFlags |= SC_MULTISTEPUNDOREDO;
  521C        const int linesAdded = LinesTotal() - prevLinesTotal;
  522C        if (linesAdded != 0)
  523C        multiLine = true;
  524C        if (step == steps - 1) {
  525C        modFlags |= SC_LASTSTEPINUNDOREDO;
  526C        if (multiLine)
  527C        modFlags |= SC_MULTILINEUNDOREDO;
  528C        }
  529C        NotifyModified(
  530C        DocModification(modFlags, action.position, action.lenData,
  531C        linesAdded, action.data));
489U532U        }
490R        if (step == steps - 1)  
491R        modFlags |= SC_LASTSTEPINUNDOREDO;  
492R        NotifyModified(  
493R            DocModification(modFlags, action.position / 2, action.lenData,  
494R                            LinesTotal() - prevLinesTotal, action.data));  
495R        }  
496U533U 
497C        bool endSavePoint = cb.IsSavePoint(); 534C        bool endSavePoint = cb.IsSavePoint();
498C        if (startSavePoint != endSavePoint) 535C        if (startSavePoint != endSavePoint)
499C        NotifySavePoint(endSavePoint); 536C        NotifySavePoint(endSavePoint);
  537C        }
500U538U        enteredCount--;
501U539U    }
502U540U    return newPos;
21 skipped lines
524U562U */
525U563Ubool Document::InsertString(int position, const char *s, size_t insertLength) {
526U564U    bool changed = false;
  565C    if (insertLength > 0) {
527C    char *sWithStyle = new char[insertLength * 2]; 566C        char *sWithStyle = new char[insertLength * 2];
528C    if (sWithStyle) { 567C        if (sWithStyle) {
529C        for (size_t i = 0; i < insertLength; i++) { 568C        for (size_t i = 0; i < insertLength; i++) {
530C        sWithStyle[i*2] = s[i]; 569C        sWithStyle[i*2] = s[i];
531C        sWithStyle[i*2 + 1] = 0; 570C        sWithStyle[i*2 + 1] = 0;
  571C        }
  572C        changed = InsertStyledString(position*2, sWithStyle,
  573C        static_cast<int>(insertLength*2));
  574C        delete []sWithStyle;
532U575U        }
533R        changed = InsertStyledString(position*2, sWithStyle,  
534R        static_cast<int>(insertLength*2));  
535R        delete []sWithStyle;  
536U576U    }
537U577U    return changed;
538U578U}
72 skipped lines
611U651U        CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs);
612U652U        int thisLineStart = LineStart(line);
613U653U        int indentPos = GetLineIndentPosition(line);
  654A        BeginUndoAction();
614U655U        DeleteChars(thisLineStart, indentPos - thisLineStart);
615U656U        InsertString(thisLineStart, linebuf);
  657A        EndUndoAction();
616U658U    }
617U659U}
618U660U 
56 skipped lines
675U717U    // Dedent - suck white space off the front of the line to dedent by equivalent of a tab
676U718U    for (int line = lineBottom; line >= lineTop; line--) {
677U719U        int indentOfLine = GetLineIndentation(line);
678C        if (forwards) 720C        if (forwards) {
  721C        if (LineStart(line) < LineEnd(line)) {
679C        SetLineIndentation(line, indentOfLine + IndentSize()); 722C        SetLineIndentation(line, indentOfLine + IndentSize());
  723C        }
680C        else 724C        } else {
681U725U        SetLineIndentation(line, indentOfLine - IndentSize());
  726A        }
682U727U    }
683U728U}
684U729U 
33 skipped lines
718U763U 
719U764U    for (int pos = 0; pos < Length(); pos++) {
720U765U        if (cb.CharAt(pos) == '\r') {
721C        if (cb.CharAt(pos + 1) == '\n') {  766C        if (cb.CharAt(pos + 1) == '\n') {
722U767U        // CRLF
723U768U        if (eolModeSet == SC_EOL_CR) {
724U769U        DeleteChars(pos + 1, 1); // Delete the LF
2 skipped lines
727U772U        } else {
728U773U        pos++;
729U774U        }
730C        } else {  775C        } else {
731U776U        // CR
732U777U        if (eolModeSet == SC_EOL_CRLF) {
733U778U        InsertString(pos + 1, "\n", 1); // Insert LF
18 skipped lines
752U797U    EndUndoAction();
753U798U}
754U799U 
755Cint Document::ParaDown(int pos) { 800Cbool Document::IsWhiteLine(int line) {
756C    int line = LineFromPosition(pos); 801C    int currentChar = LineStart(line);
757C    while (line < LinesTotal() && LineStart(line) != LineEnd(line)) { // skip non-empty lines 802C    int endLine = LineEnd(line);
758C        line++;  
759C    }  
760C    while (line < LinesTotal() && LineStart(line) == LineEnd(line)) { // skip empty lines 803C    while (currentChar < endLine) {
  804C        if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') {
  805C        return false;
  806C        }
761C        line++; 807C        ++currentChar;
762U808U    }
763C    if (line < LinesTotal())  
764C        return LineStart(line);  
765C    else // end of a document  
766C        return LineEnd(line-1); 809C    return true;
767U810U}
768U811U 
769U812Uint Document::ParaUp(int pos) {
770U813U    int line = LineFromPosition(pos);
771U814U    line--;
772C    while (line >= 0 && LineStart(line) == LineEnd(line)) { // skip empty lines 815C    while (line >= 0 && IsWhiteLine(line)) { // skip empty lines
773U816U        line--;
774U817U    }
775C    while (line >= 0 && LineStart(line) != LineEnd(line)) { // skip non-empty lines 818C    while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines
776U819U        line--;
777U820U    }
778U821U    line++;
779U822U    return LineStart(line);
780U823U}
781U824U 
  825Aint Document::ParaDown(int pos) {
  826A    int line = LineFromPosition(pos);
  827A    while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines
  828A        line++;
  829A    }
4 skipped lines
  834A        return LineStart(line);
  835A    else // end of a document
  836A        return LineEnd(line-1);
  837A}
  838A 
782U839UDocument::charClassification Document::WordCharClass(unsigned char ch) {
783U840U    if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
784U841U        return ccWord;
141 skipped lines
926U983U        pdoc(pdoc_), end(end_) {
927U984U    }
928U985U 
  986A    virtual ~DocumentIndexer() {
  987A    }
  988A 
929U989U    virtual char CharAt(int index) {
930U990U        if (index < 0 || index >= end)
931U991U        return 0;
69 skipped lines
1001U1061U        if (line == lineRangeStart) {
1002U1062U        if ((startPos != endOfLine) && (searchEnd == '$'))
1003U1063U        continue; // Can't match end of line if start position before end of line
1004C        endOfLine = startPos+1; 1064C        endOfLine = startPos;
1005U1065U        }
1006U1066U        }
1007U1067U 
5 skipped lines
1013U1073U        if (increment == -1) {
1014U1074U        // Check for the last match on this line.
1015U1075U        int repetitions = 1000;   // Break out of infinite loop
1016C        while (success && (pre->eopat[0] <= (endOfLine+1)) && (repetitions--)) { 1076C        while (success && (pre->eopat[0] <= endOfLine) && (repetitions--)) {
1017C        success = pre->Execute(di, pos+1, endOfLine+1); 1077C        success = pre->Execute(di, pos+1, endOfLine);
1018U1078U        if (success) {
1019C        if (pre->eopat[0] <= (minPos+1)) { 1079C        if (pre->eopat[0] <= minPos) {
1020U1080U        pos = pre->bopat[0];
1021U1081U        lenRet = pre->eopat[0] - pre->bopat[0];
1022U1082U        } else {
29 skipped lines
1052U1112U        char firstChar = s[0];
1053U1113U        if (!caseSensitive)
1054U1114U        firstChar = static_cast<char>(MakeUpperCase(firstChar));
1055C        int pos = startPos; 1115C        int pos = forward ? startPos : (startPos - 1);
1056U1116U        while (forward ? (pos < endSearch) : (pos >= endSearch)) {
1057U1117U        char ch = CharAt(pos);
1058U1118U        if (caseSensitive) {
1059U1119U        if (ch == firstChar) {
1060U1120U        bool found = true;
  1121A        if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
1061U1122U        for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
1062U1123U        ch = CharAt(pos + posMatch);
1063U1124U        if (ch != s[posMatch])
9 skipped lines
1073U1134U        } else {
1074U1135U        if (MakeUpperCase(ch) == firstChar) {
1075U1136U        bool found = true;
  1137A        if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
1076U1138U        for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
1077U1139U        ch = CharAt(pos + posMatch);
1078U1140U        if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))
106 skipped lines
1185U1247U}
1186U1248U 
1187U1249Uvoid Document::ChangeCase(Range r, bool makeUpperCase) {
1188C    for (int pos = r.start; pos < r.end; pos++{ 1250C    for (int pos = r.start; pos < r.end;) {
1189U1251U        int len = LenChar(pos);
1190C        if (dbcsCodePage && (len > 1)) { 1252C        if (len == 1) {
1191C        pos += len;  
1192C        } else {  
1193U1253U        char ch = CharAt(pos);
1194U1254U        if (makeUpperCase) {
1195U1255U        if (IsLowerCase(ch)) {
5 skipped lines
1201U1261U        }
1202U1262U        }
1203U1263U        }
  1264A        pos += len;
1204U1265U    }
1205U1266U}
1206U1267U 
58 skipped lines
1265U1326U        return false;
1266U1327U    } else {
1267U1328U        enteredCount++;
1268R        int prevEndStyled = endStyled;  
1269U1329U        bool didChange = false;
  1330C        int startMod = 0;
1270C        int lastChange = 0; 1331C        int endMod = 0;
1271U1332U        for (int iPos = 0; iPos < length; iPos++, endStyled++) {
1272U1333U        PLATFORM_ASSERT(endStyled < Length());
1273U1334U        if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
  1335A        if (!didChange) {
  1336A        startMod = endStyled;
  1337A        }
1274U1338U        didChange = true;
1275C        lastChange = iPos; 1339C        endMod = endStyled;
1276U1340U        }
1277U1341U        }
1278U1342U        if (didChange) {
1279U1343U        DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
1280C                           prevEndStyled, lastChange); 1344C                           startMod, endMod - startMod + 1);
1281U1345U        NotifyModified(mh);
1282U1346U        }
1283U1347U        enteredCount--;
191 skipped lines
1475U1539U    }
1476U1540U    return pos;
1477U1541U}
  1542A 
  1543Astatic char BraceOpposite(char ch) {
  1544A    switch (ch) {
  1545A    case '(':
  1546A        return ')';
42 skipped lines
  1589A        }
  1590A        position = position + direction;
  1591A    }
  1592A    return - 1;
  1593A}
1478U1594U 

   Text comparison Options  

Match character case: yes.
Match line endings: no.
Match spaces

At start of lines: yes,
In middle of lines: yes,
At end of lines: yes.
Blank lines as empty lines: no.
Activate comparison algorithm
At word level: yes,
At character level: no.


   Legend  

UExample of unchanged line
CExample of modified line
AExample of added line
RExample of removed line
IExample of ignored line
Modified text
Added text
Removed text

This report has been generated by Ellié Computing Merge on 2006-09-07 16:23:31.001 +0200.
© 2005-2006 Ellié Computing http://www.elliecomputing.com. All rights reserved.