diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CellBuffer.cxx | 8 | ||||
| -rw-r--r-- | src/CellBuffer.h | 2 | ||||
| -rw-r--r-- | src/Document.h | 2 | ||||
| -rw-r--r-- | src/Editor.cxx | 6 | ||||
| -rw-r--r-- | src/SplitVector.h | 18 | 
5 files changed, 36 insertions, 0 deletions
| diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 19f6670f6..11b8b4acd 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -375,6 +375,14 @@ const char *CellBuffer::BufferPointer() {  	return substance.BufferPointer();  } +const char *CellBuffer::RangePointer(int position, int rangeLength) { +	return substance.RangePointer(position, rangeLength); +} + +int CellBuffer::GapPosition() const { +	return substance.GapPosition(); +} +  // The char* returned is to an allocation owned by the undo history  const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) {  	char *data = 0; diff --git a/src/CellBuffer.h b/src/CellBuffer.h index a82a3973b..388b9027b 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -157,6 +157,8 @@ public:  	char StyleAt(int position) const;  	void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const;  	const char *BufferPointer(); +	const char *RangePointer(int position, int rangeLength); +	int GapPosition() const;  	int Length() const;  	void Allocate(int newSize); diff --git a/src/Document.h b/src/Document.h index 18bf00a3d..7e03f3d9e 100644 --- a/src/Document.h +++ b/src/Document.h @@ -298,6 +298,8 @@ public:  	void SetSavePoint();  	bool IsSavePoint() { return cb.IsSavePoint(); }  	const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); } +	const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); } +	int GapPosition() const { return cb.GapPosition(); }  	int SCI_METHOD GetLineIndentation(int line);  	void SetLineIndentation(int line, int indent); diff --git a/src/Editor.cxx b/src/Editor.cxx index c3a4eafb4..8aea4db1d 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8910,6 +8910,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_GETCHARACTERPOINTER:  		return reinterpret_cast<sptr_t>(pdoc->BufferPointer()); +	case SCI_GETRANGEPOINTER: +		return reinterpret_cast<sptr_t>(pdoc->RangePointer(wParam, lParam)); + +	case SCI_GETGAPPOSITION: +		return pdoc->GapPosition(); +  	case SCI_SETEXTRAASCENT:  		vs.extraAscent = wParam;  		InvalidateStyleRedraw(); diff --git a/src/SplitVector.h b/src/SplitVector.h index 44d5ddc0e..0ccf6c9f4 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -261,6 +261,24 @@ public:  		body[lengthBody] = 0;  		return body;  	} + +	T *RangePointer(int position, int rangeLength) { +		if (position < part1Length) { +			if ((position + rangeLength) > part1Length) { +				// Range overlaps gap, so move gap to start of range. +				GapTo(position); +				return body + position + gapLength; +			} else { +				return body + position ; +			} +		} else { +			return body + position + gapLength; +		} +	} + +	int GapPosition() const { +		return part1Length;  +	}  };  #endif | 
