Fix condition where Join Lines does one too many lines

Fix #8503, close #8506
pull/8516/head
Scott Sumner 4 years ago committed by Don HO
parent 4bf662d031
commit 8b93240c59
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

@ -1438,9 +1438,18 @@ void Notepad_plus::command(int id)
break;
case IDM_EDIT_JOIN_LINES:
_pEditView->execute(SCI_TARGETFROMSELECTION);
_pEditView->execute(SCI_LINESJOIN);
break;
{
const pair<int, int> lineRange = _pEditView->getSelectionLinesRange();
if (lineRange.first != lineRange.second)
{
auto anchorPos = _pEditView->execute(SCI_POSITIONFROMLINE, lineRange.first);
auto caretPos = _pEditView->execute(SCI_GETLINEENDPOSITION, lineRange.second);
_pEditView->execute(SCI_SETSELECTION, caretPos, anchorPos);
_pEditView->execute(SCI_TARGETFROMSELECTION);
_pEditView->execute(SCI_LINESJOIN);
}
}
break;
case IDM_EDIT_LINE_UP:
_pEditView->currentLinesUp();

Loading…
Cancel
Save