SF.net SVN: geany: [877] trunk/scintilla
eht16 at users.sourceforge.net
eht16 at xxxxx
Tue Oct 10 14:28:08 UTC 2006
Revision: 877
http://svn.sourceforge.net/geany/?rev=877&view=rev
Author: eht16
Date: 2006-10-10 07:27:58 -0700 (Tue, 10 Oct 2006)
Log Message:
-----------
Applied patch from Armel Asselin (thanks). It adds SC_START_ACTION notification.
Modified Paths:
--------------
trunk/scintilla/CellBuffer.cxx
trunk/scintilla/CellBuffer.h
trunk/scintilla/Document.cxx
trunk/scintilla/include/Scintilla.h
Modified: trunk/scintilla/CellBuffer.cxx
===================================================================
--- trunk/scintilla/CellBuffer.cxx 2006-10-10 13:52:22 UTC (rev 876)
+++ trunk/scintilla/CellBuffer.cxx 2006-10-10 14:27:58 UTC (rev 877)
@@ -316,10 +316,10 @@
delete linesData[line].handleSet;
linesData[line].handleSet = 0;
} else {
- bool performedDeletion =
+ bool performedDeletion =
linesData[line].handleSet->RemoveNumber(markerNum);
while (all && performedDeletion) {
- performedDeletion =
+ performedDeletion =
linesData[line].handleSet->RemoveNumber(markerNum);
}
if (linesData[line].handleSet->Length() == 0) {
@@ -446,7 +446,7 @@
}
}
-void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData) {
+void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData, bool &startSequence) {
EnsureUndoRoom();
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
@@ -454,6 +454,8 @@
if (currentAction < savePoint) {
savePoint = -1;
}
+
+ int oldCurrentAction = currentAction;
if (currentAction >= 1) {
if (0 == undoSequenceDepth) {
// Top level actions may not always be coalesced
@@ -497,6 +499,7 @@
} else {
currentAction++;
}
+ startSequence = oldCurrentAction!=currentAction;
actions[currentAction].Create(at, position, data, lengthData);
currentAction++;
actions[currentAction].Create(startAction);
@@ -714,7 +717,7 @@
return ByteAt(position*2 + 1);
}
-const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
+const char *CellBuffer::InsertString(int position, char *s, int insertLength, bool &startSequence) {
char *data = 0;
// InsertString and DeleteChars are the bottleneck though which all changes occur
if (!readOnly) {
@@ -725,7 +728,7 @@
for (int i = 0; i < insertLength / 2; i++) {
data[i] = s[i * 2];
}
- uh.AppendAction(insertAction, position / 2, data, insertLength / 2);
+ uh.AppendAction(insertAction, position / 2, data, insertLength / 2, startSequence);
}
BasicInsertString(position, s, insertLength);
@@ -760,7 +763,7 @@
return changed;
}
-const char *CellBuffer::DeleteChars(int position, int deleteLength) {
+const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) {
// InsertString and DeleteChars are the bottleneck though which all changes occur
PLATFORM_ASSERT(deleteLength > 0);
char *data = 0;
@@ -771,7 +774,7 @@
for (int i = 0; i < deleteLength / 2; i++) {
data[i] = ByteAt(position + i * 2);
}
- uh.AppendAction(removeAction, position / 2, data, deleteLength / 2);
+ uh.AppendAction(removeAction, position / 2, data, deleteLength / 2, startSequence);
}
BasicDeleteChars(position, deleteLength);
Modified: trunk/scintilla/CellBuffer.h
===================================================================
--- trunk/scintilla/CellBuffer.h 2006-10-10 13:52:22 UTC (rev 876)
+++ trunk/scintilla/CellBuffer.h 2006-10-10 14:27:58 UTC (rev 877)
@@ -119,7 +119,7 @@
UndoHistory();
~UndoHistory();
- void AppendAction(actionType at, int position, char *data, int length);
+ void AppendAction(actionType at, int position, char *data, int length, bool &startSequence);
void BeginUndoAction();
void EndUndoAction();
@@ -190,14 +190,14 @@
int Lines();
int LineStart(int line);
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
- const char *InsertString(int position, char *s, int insertLength);
+ const char *InsertString(int position, char *s, int insertLength, bool &startSequence);
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
/// @return true if the style of a character is changed.
bool SetStyleAt(int position, char style, char mask='\377');
bool SetStyleFor(int position, int length, char style, char mask);
- const char *DeleteChars(int position, int deleteLength);
+ const char *DeleteChars(int position, int deleteLength, bool &startSequence);
bool IsReadOnly();
void SetReadOnly(bool set);
Modified: trunk/scintilla/Document.cxx
===================================================================
--- trunk/scintilla/Document.cxx 2006-10-10 13:52:22 UTC (rev 876)
+++ trunk/scintilla/Document.cxx 2006-10-10 14:27:58 UTC (rev 877)
@@ -380,7 +380,8 @@
0, 0));
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
- const char *text = cb.DeleteChars(pos * 2, len * 2);
+ bool startSequence=false;
+ const char *text = cb.DeleteChars(pos * 2, len * 2, startSequence);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
if ((pos < Length()) || (pos == 0))
@@ -389,7 +390,7 @@
ModifiedAt(pos-1);
NotifyModified(
DocModification(
- SC_MOD_DELETETEXT | SC_PERFORMED_USER,
+ SC_MOD_DELETETEXT | SC_PERFORMED_USER | (startSequence?SC_START_ACTION:0),
pos, len,
LinesTotal() - prevLinesTotal, text));
}
@@ -415,13 +416,14 @@
0, s));
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
- const char *text = cb.InsertString(position, s, insertLength);
+ bool startSequence=false;
+ const char *text = cb.InsertString(position, s, insertLength, startSequence);
if (startSavePoint && cb.IsCollectingUndo())
NotifySavePoint(!startSavePoint);
ModifiedAt(position / 2);
NotifyModified(
DocModification(
- SC_MOD_INSERTTEXT | SC_PERFORMED_USER,
+ SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_START_ACTION:0),
position / 2, insertLength / 2,
LinesTotal() - prevLinesTotal, text));
}
Modified: trunk/scintilla/include/Scintilla.h
===================================================================
--- trunk/scintilla/include/Scintilla.h 2006-10-10 13:52:22 UTC (rev 876)
+++ trunk/scintilla/include/Scintilla.h 2006-10-10 14:27:58 UTC (rev 877)
@@ -647,7 +647,8 @@
#define SC_MOD_BEFOREINSERT 0x400
#define SC_MOD_BEFOREDELETE 0x800
#define SC_MULTILINEUNDOREDO 0x1000
-#define SC_MODEVENTMASKALL 0x1FFF
+#define SC_START_ACTION 0x2000
+#define SC_MODEVENTMASKALL 0x2FFF
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list