diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 1ffe334fc..13388ea20 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -49,6 +49,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) static bool prevWasEdit = false; if (notification->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT)) { + _pEditView->updateBeginEndSelectPosition(notification->modificationType & SC_MOD_INSERTTEXT, notification->position, notification->length); prevWasEdit = true; _linkTriggered = true; ::InvalidateRect(notifyView->getHSelf(), NULL, TRUE); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 434acb972..c10e45cea 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -2057,6 +2057,19 @@ void ScintillaEditView::beginOrEndSelect() } } +void ScintillaEditView::updateBeginEndSelectPosition(const bool is_insert, const int position, const int length) +{ + if(_beginSelectPosition != -1 && position < _beginSelectPosition - 1) + { + if(is_insert) + _beginSelectPosition += length; + else + _beginSelectPosition -= length; + + assert(_beginSelectPosition >= 0); + } +} + void ScintillaEditView::marginClick(int position, int modifiers) { int lineClick = int(execute(SCI_LINEFROMPOSITION, position, 0)); diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h index b51748b7e..91472ed8a 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.h @@ -335,7 +335,8 @@ public: bool hasMarginShowed(int witchMarge) { return (execute(SCI_GETMARGINWIDTHN, witchMarge, 0) != 0); }; - + + void updateBeginEndSelectPosition(const bool is_insert, const int position, const int length); void marginClick(int position, int modifiers); void setMakerStyle(folderStyle style) {