diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 5 | ||||
| -rw-r--r-- | src/Selection.cxx | 15 | ||||
| -rw-r--r-- | src/Selection.h | 1 | 
3 files changed, 21 insertions, 0 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 7e1da9e20..f254af4dd 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -9526,6 +9526,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		Redraw();  		break; +	case SCI_DROPSELECTIONN: +		sel.DropSelection(wParam); +		Redraw(); +		break; +  	case SCI_SETMAINSELECTION:  		sel.SetMain(wParam);  		Redraw(); diff --git a/src/Selection.cxx b/src/Selection.cxx index 0c02c198b..ae4d8bfc7 100644 --- a/src/Selection.cxx +++ b/src/Selection.cxx @@ -305,6 +305,21 @@ void Selection::AddSelectionWithoutTrim(SelectionRange range) {  	mainRange = ranges.size() - 1;  } +void Selection::DropSelection(size_t r) { +	if ((ranges.size() > 1) && (r < ranges.size())) { +		size_t mainNew = mainRange; +		if (mainNew >= r) { +			if (mainNew == 0) { +				mainNew = ranges.size() - 2; +			} else { +				mainNew--; +			} +		} +		ranges.erase(ranges.begin() + r); +		mainRange = mainNew; +	} +} +  void Selection::TentativeSelection(SelectionRange range) {  	if (!tentativeMain) {  		rangesSaved = ranges; diff --git a/src/Selection.h b/src/Selection.h index 956a0f99d..e84d3c32c 100644 --- a/src/Selection.h +++ b/src/Selection.h @@ -167,6 +167,7 @@ public:  	void SetSelection(SelectionRange range);  	void AddSelection(SelectionRange range);  	void AddSelectionWithoutTrim(SelectionRange range); +	void DropSelection(size_t r);  	void TentativeSelection(SelectionRange range);  	void CommitTentative();  	int CharacterInSelection(int posCharacter) const; | 
