Make split-lines work with multi-edge rightmost specified edge

Implements a fix whereby the RIGHTMOST user specified value in the vertical edge box is the column to split by, e.g. 60 in the following example: [15, 40, 60]

If the contents of the box were instead [15, 60, 40], the split-by column would be 40, as that is the RIGHTMOST value.

Fix #8262, close #9387
pull/9405/head
Scott Sumner 4 years ago committed by Don HO
parent a2ee3e6254
commit 5003a45306
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

@ -1598,14 +1598,22 @@ void Notepad_plus::command(int id)
auto caretPos = _pEditView->execute(SCI_GETLINEENDPOSITION, lineRange.second);
_pEditView->execute(SCI_SETSELECTION, caretPos, anchorPos);
_pEditView->execute(SCI_TARGETFROMSELECTION);
if (_pEditView->execute(SCI_GETEDGEMODE) == EDGE_NONE)
int edgeMode = static_cast<int>(_pEditView->execute(SCI_GETEDGEMODE));
if (edgeMode == EDGE_NONE)
{
_pEditView->execute(SCI_LINESSPLIT);
_pEditView->execute(SCI_LINESSPLIT, 0);
}
else
{
auto textWidth = _pEditView->execute(SCI_TEXTWIDTH, STYLE_LINENUMBER, reinterpret_cast<LPARAM>("P"));
auto edgeCol = _pEditView->execute(SCI_GETEDGECOLUMN);
auto textWidth = _pEditView->execute(SCI_TEXTWIDTH, STYLE_DEFAULT, reinterpret_cast<LPARAM>("P"));
auto edgeCol = _pEditView->execute(SCI_GETEDGECOLUMN); // will work for edgeMode == EDGE_BACKGROUND
if (edgeMode == EDGE_MULTILINE)
{
NppParameters& nppParam = NppParameters::getInstance();
ScintillaViewParams& svp = const_cast<ScintillaViewParams&>(nppParam.getSVP());
edgeCol = svp._edgeMultiColumnPos.back(); // the LAST edge column specified by the user
}
++edgeCol; // compensate for zero-based column number
_pEditView->execute(SCI_LINESSPLIT, textWidth * edgeCol);
}
}

Loading…
Cancel
Save