scintilla: Fix invalid memory access in MoveSelectedLines
Fixes #2066. X-Scintilla-Commit-ID: df5c32512d3d6b71ee6138c709b392258c3a1991, 25a0367e9349c8475c619a054af7bf1daf15b04c X-Scintilla-Bug-ID: https://sourceforge.net/p/scintilla/bugs/2078/
This commit is contained in:
parent
44c26adbc3
commit
d551765d59
@ -1003,6 +1003,10 @@ void Editor::VerticalCentreCaret() {
|
||||
|
||||
void Editor::MoveSelectedLines(int lineDelta) {
|
||||
|
||||
if (sel.IsRectangular()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if selection doesn't start at the beginning of the line, set the new start
|
||||
Sci::Position selectionStart = SelectionStart().Position();
|
||||
const Sci::Line startLine = pdoc->SciLineFromPosition(selectionStart);
|
||||
@ -1042,7 +1046,6 @@ void Editor::MoveSelectedLines(int lineDelta) {
|
||||
SelectionText selectedText;
|
||||
CopySelectionRange(&selectedText);
|
||||
|
||||
Sci::Position selectionLength = SelectionRange(selectionStart, selectionEnd).Length();
|
||||
const Point currentLocation = LocationFromPosition(CurrentPosition());
|
||||
const Sci::Line currentLine = LineFromLocation(currentLocation);
|
||||
|
||||
@ -1055,7 +1058,7 @@ void Editor::MoveSelectedLines(int lineDelta) {
|
||||
pdoc->InsertString(pdoc->Length(), eol, strlen(eol));
|
||||
GoToLine(currentLine + lineDelta);
|
||||
|
||||
selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectionLength);
|
||||
Sci::Position selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectedText.Length());
|
||||
if (appendEol) {
|
||||
const Sci::Position lengthInserted = pdoc->InsertString(CurrentPosition() + selectionLength, eol, strlen(eol));
|
||||
selectionLength += lengthInserted;
|
||||
|
Loading…
x
Reference in New Issue
Block a user