Fix stream sort of selected text doing one too many lines

Fix #8447, close #8453
This commit is contained in:
Scott Sumner 2020-06-23 08:49:40 -04:00 committed by Don HO
parent 267da64d33
commit 5a2cabf14e
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
2 changed files with 8 additions and 1 deletions

View File

@ -583,7 +583,7 @@ void Notepad_plus::command(int id)
hasLineSelection = selStart != selEnd;
if (hasLineSelection)
{
pair<int, int> lineRange = _pEditView->getSelectionLinesRange();
const pair<int, int> lineRange = _pEditView->getSelectionLinesRange();
// One single line selection is not allowed.
if (lineRange.first == lineRange.second)
{

View File

@ -2780,6 +2780,13 @@ pair<int, int> ScintillaEditView::getSelectionLinesRange() const
range.first = static_cast<int32_t>(execute(SCI_LINEFROMPOSITION, start));
range.second = static_cast<int32_t>(execute(SCI_LINEFROMPOSITION, end));
if ((range.first != range.second) && (execute(SCI_POSITIONFROMLINE, range.second) == end))
{
// if the end of the selection includes the line-ending,
// then don't include the following line in the range
--range.second;
}
return range;
}