diff options
| author | nyamatongwe <unknown> | 2001-04-04 13:36:39 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2001-04-04 13:36:39 +0000 | 
| commit | 9b04df8e99b54645a92580712a6551b39ac511f5 (patch) | |
| tree | 402c5ace645cc7865f51d360d1de055628d3967b /src | |
| parent | 93b871d1d8fbb076510e2c410ba57a0980a22ec8 (diff) | |
| download | scintilla-mirror-9b04df8e99b54645a92580712a6551b39ac511f5.tar.gz | |
Target API for changing document withot visible changes: SetTargetStart,
SetTargetEnd, and ReplaceTarget.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 34 | ||||
| -rw-r--r-- | src/Editor.h | 2 | 
2 files changed, 32 insertions, 4 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 479157e39..9f65203d2 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -92,6 +92,9 @@ Editor::Editor() {  	currentPos = 0;  	anchor = 0; +	targetStart = 0; +	targetEnd = 0; +	  	topLine = 0;  	posTopLine = 0; @@ -1570,7 +1573,7 @@ void Editor::AddCharUTF(char *s, unsigned int len) {  void Editor::ClearSelection() {  	if (selType == selRectangle) { -    	pdoc->BeginUndoAction(); +    		pdoc->BeginUndoAction();  		int lineStart = pdoc->LineFromPosition(SelectionStart());  		int lineEnd = pdoc->LineFromPosition(SelectionEnd());  		int startPos = SelectionStart(); @@ -1582,16 +1585,16 @@ void Editor::ClearSelection() {  			}  		}  		SetEmptySelection(startPos); -    	pdoc->EndUndoAction(); +    		pdoc->EndUndoAction();  		selType = selStream;  	} else {  		int startPos = SelectionStart();  		unsigned int chars = SelectionEnd() - startPos;  		SetEmptySelection(startPos);  		if (0 != chars) { -           	pdoc->BeginUndoAction(); +           		pdoc->BeginUndoAction();  			pdoc->DeleteChars(startPos, chars); -           	pdoc->EndUndoAction(); +           		pdoc->EndUndoAction();  		}  	}  } @@ -3555,6 +3558,29 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		}  		break; +	case SCI_SETTARGETSTART: +		targetStart = wParam; +		break; +	 +	case SCI_SETTARGETEND: +		targetEnd = wParam; +		break; +	 +	case SCI_REPLACETARGET: { +			if (lParam == 0) +				return 0; +			pdoc->BeginUndoAction(); +			unsigned int chars = targetEnd - targetStart; +			if (targetStart != targetEnd) +				pdoc->DeleteChars(targetStart, chars); +			targetEnd = targetStart; +			char *replacement = reinterpret_cast<char *>(lParam); +			pdoc->InsertString(targetStart, replacement); +			targetEnd = targetStart + strlen(replacement); +			pdoc->EndUndoAction(); +		} +		break; +	  	case EM_LINESCROLL:  	case SCI_LINESCROLL:  		ScrollTo(topLine + lParam); diff --git a/src/Editor.h b/src/Editor.h index cf3996ffa..e82496663 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -116,6 +116,8 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	int originalAnchorPos;  	int currentPos;  	int anchor; +	int targetStart; +	int targetEnd;  	int topLine;  	int posTopLine; | 
