Fix the Begin/End Select after deletion problem

Fix #15221, close #15278
This commit is contained in:
Alan Kilborn 2024-06-12 20:13:31 -04:00 committed by Don Ho
parent 720f5f8a8e
commit 2e116251e2
1 changed files with 5 additions and 3 deletions

View File

@ -2787,14 +2787,16 @@ void ScintillaEditView::addText(size_t length, const char *buf)
void ScintillaEditView::beginOrEndSelect(bool isColumnMode)
{
auto currPos = execute(SCI_GETCURRENTPOS);
if (_beginSelectPosition == -1)
{
_beginSelectPosition = execute(SCI_GETCURRENTPOS);
_beginSelectPosition = currPos;
}
else
{
execute(SCI_SETSELECTIONMODE, static_cast<WPARAM>(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM));
execute(SCI_SETANCHOR, static_cast<WPARAM>(_beginSelectPosition));
execute(SCI_CHANGESELECTIONMODE, static_cast<WPARAM>(isColumnMode ? SC_SEL_RECTANGLE : SC_SEL_STREAM));
execute(isColumnMode ? SCI_SETANCHOR : SCI_SETSEL, static_cast<WPARAM>(_beginSelectPosition), static_cast<LPARAM>(currPos));
_beginSelectPosition = -1;
}
}