| 253 skipped lines |
| 254 | U | 254 | U | linesData[i] = linesData[i + 1]; |
|
|
|
| 257 | C | // Level information merges back onto previous line | | 257 | C | // Move up following lines but merge header flag from this line |
| 258 | C | int posAbove = pos - 1; | | 258 | C | // to line before to avoid a temporary disappearence causing expansion. |
| 259 | C | if (posAbove < 0) | | |
| 260 | C | posAbove = 0; | | 259 | C | int firstHeader = levels[pos] & SC_FOLDLEVELHEADERFLAG; |
| 261 | C | for (int j = posAbove; j < lines; j++) { | | 260 | C | for (int j = pos; j < lines; j++) { |
| 262 | U | 261 | U | levels[j] = levels[j + 1]; |
|
|
| | | 263 | A | if (pos > 0) |
| | | 264 | A | levels[pos-1] |= firstHeader; |
|
|
|
| 197 skipped lines |
| 464 | U | 465 | U | } else if (currentAction == savePoint) { |
|
| 465 | U | 466 | U | currentAction++; |
|
| 466 | U | 467 | U | } else if ((at == insertAction) && |
|
| 467 | C | (position != (actPrevious.position + actPrevious.lenData*2))) { | | 468 | C | (position != (actPrevious.position + actPrevious.lenData))) { |
| 468 | U | 469 | U | // Insertions must be immediately after to coalesce |
|
| 469 | U | 470 | U | currentAction++; |
|
| 470 | U | 471 | U | } else if (!actions[currentAction].mayCoalesce) { |
|
| 1 skipped line |
| 472 | U | 473 | U | currentAction++; |
|
| 473 | U | 474 | U | } else if (at == removeAction) { |
|
| 474 | U | 475 | U | if ((lengthData == 1) || (lengthData == 2)){ |
|
| 475 | C | if ((position + lengthData * 2) == actPrevious.position) { | | 476 | C | if ((position + lengthData) == actPrevious.position) { |
| 476 | U | 477 | U | ; // Backspace -> OK |
|
| 477 | U | 478 | U | } else if (position == actPrevious.position) { |
|
| 478 | U | 479 | U | ; // Delete -> OK |
|
| 245 skipped lines |
| 724 | U | 725 | U | for (int i = 0; i < insertLength / 2; i++) { |
|
| 725 | U | 726 | U | data[i] = s[i * 2]; |
|
|
| 727 | C | uh.AppendAction(insertAction, position, data, insertLength / 2); | | 728 | C | uh.AppendAction(insertAction, position / 2, data, insertLength / 2); |
|
|
| 730 | U | 731 | U | BasicInsertString(position, s, insertLength); |
|
| 1 skipped line |
|
|
|
| 735 | R | void CellBuffer::InsertCharStyle(int position, char ch, char style) { | | |
| 736 | R | char s[2]; | | |
| 737 | R | s[0] = ch; | | |
| 738 | R | s[1] = style; | | |
| 739 | R | InsertString(position*2, s, 2); | | |
| 740 | R | } | | |
| 741 | R | | | |
| 742 | U | 736 | U | bool CellBuffer::SetStyleAt(int position, char style, char mask) { |
|
|
| 744 | U | 738 | U | char curVal = ByteAt(position * 2 + 1); |
|
| 23 skipped lines |
|
| 769 | U | 763 | U | const char *CellBuffer::DeleteChars(int position, int deleteLength) { |
|
| 770 | U | 764 | U | // InsertString and DeleteChars are the bottleneck though which all changes occur |
|
| | | 765 | A | PLATFORM_ASSERT(deleteLength > 0); |
|
| 772 | U | 767 | U | if (!readOnly) { |
|
| 773 | U | 768 | U | if (collectingUndo) { |
|
| 2 skipped lines |
| 776 | U | 771 | U | for (int i = 0; i < deleteLength / 2; i++) { |
|
| 777 | U | 772 | U | data[i] = ByteAt(position + i * 2); |
|
|
| 779 | C | uh.AppendAction(removeAction, position, data, deleteLength / 2); | | 774 | C | uh.AppendAction(removeAction, position / 2, data, deleteLength / 2); |
|
|
| 782 | U | 777 | U | BasicDeleteChars(position, deleteLength); |
|
| 91 skipped lines |
| 874 | U | 869 | U | //Platform::DebugPrintf("Inserting at %d for %d\n", position, insertLength); |
|
| 875 | U | 870 | U | if (insertLength == 0) |
|
|
| | | 872 | A | PLATFORM_ASSERT(insertLength > 0); |
| 877 | U | 873 | U | RoomFor(insertLength); |
|
| 878 | U | 874 | U | GapTo(position); |
|
|
| 148 skipped lines |
|
|
| 1030 | U | 1026 | U | bool CellBuffer::CanUndo() { |
|
| 1031 | C | return (!readOnly) && (uh.CanUndo()); | | 1027 | C | return uh.CanUndo(); |
|
|
| 1034 | U | 1030 | U | int CellBuffer::StartUndo() { |
|
| 7 skipped lines |
| 1042 | U | 1038 | U | void CellBuffer::PerformUndoStep() { |
|
| 1043 | U | 1039 | U | const Action &actionStep = uh.GetUndoStep(); |
|
| 1044 | U | 1040 | U | if (actionStep.at == insertAction) { |
|
| 1045 | C | BasicDeleteChars(actionStep.position, actionStep.lenData*2); | | 1041 | C | BasicDeleteChars(actionStep.position*2, actionStep.lenData*2); |
| 1046 | U | 1042 | U | } else if (actionStep.at == removeAction) { |
|
| 1047 | U | 1043 | U | char *styledData = new char[actionStep.lenData * 2]; |
|
| 1048 | U | 1044 | U | for (int i = 0; i < actionStep.lenData; i++) { |
|
| 1049 | U | 1045 | U | styledData[i*2] = actionStep.data[i]; |
|
| 1050 | U | 1046 | U | styledData[i*2 + 1] = 0; |
|
|
| 1052 | C | BasicInsertString(actionStep.position, styledData, actionStep.lenData*2); | | 1048 | C | BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2); |
| 1053 | U | 1049 | U | delete []styledData; |
|
|
| 1055 | U | 1051 | U | uh.CompletedUndoStep(); |
|
|
|
| 1058 | U | 1054 | U | bool CellBuffer::CanRedo() { |
|
| 1059 | C | return (!readOnly) && (uh.CanRedo()); | | 1055 | C | return uh.CanRedo(); |
|
|
| 1062 | U | 1058 | U | int CellBuffer::StartRedo() { |
|
| 12 skipped lines |
| 1075 | U | 1071 | U | styledData[i*2] = actionStep.data[i]; |
|
| 1076 | U | 1072 | U | styledData[i*2 + 1] = 0; |
|
|
| 1078 | C | BasicInsertString(actionStep.position, styledData, actionStep.lenData*2); | | 1074 | C | BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2); |
| 1079 | U | 1075 | U | delete []styledData; |
|
| 1080 | U | 1076 | U | } else if (actionStep.at == removeAction) { |
|
| 1081 | C | BasicDeleteChars(actionStep.position, actionStep.lenData*2); | | 1077 | C | BasicDeleteChars(actionStep.position*2, actionStep.lenData*2); |
|
| 1083 | U | 1079 | U | uh.CompletedRedoStep(); |
|
|
| 41 skipped lines |