Skip to content

Commit 99f1e07

Browse files
committed
Update line gutter width on drop #222
1 parent 53f6a52 commit 99f1e07

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

doc/Scintilla_ChangeLog.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,38 @@ Corresponding calls added to Editor::KeyCommand():
247247
...
248248
NotifyLineCountChanged();
249249
break;
250+
251+
...
252+
253+
New code around DropAt()-call:
254+
255+
position = positionAfterDeletion;
256+
257+
*const int linesTotal = pdoc->LinesTotal();*
258+
std::string convertedText = Document::TransformLineEnds(value, lengthValue, pdoc->eolMode);
259+
260+
...
261+
262+
if (rectangular) {
263+
PasteRectangular(position, convertedText.c_str(), static_cast<int>(convertedText.length()));
264+
// Should try to select new rectangle but it may not be a rectangle now so just select the drop position
265+
SetEmptySelection(position);
266+
} else {
267+
position = MovePositionOutsideChar(position, sel.MainCaret() - position.Position());
268+
position = SelectionPosition(InsertSpace(position.Position(), position.VirtualSpace()));
269+
const int lengthInserted = pdoc->InsertString(
270+
position.Position(), convertedText.c_str(), static_cast<int>(convertedText.length()));
271+
if (lengthInserted > 0) {
272+
SelectionPosition posAfterInsertion = position;
273+
posAfterInsertion.Add(lengthInserted);
274+
SetSelection(posAfterInsertion, position);
275+
}
276+
}
277+
*if (pdoc->LinesTotal() != linesTotal) {
278+
NotifyLineCountChanged();
279+
}*
280+
281+
250282
[/**"Update gutter width"-feature**]
251283

252284
[**Drag & drop improvement #63**]

scintilla/src/Editor.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,6 +4275,7 @@ void Editor::DropAt(SelectionPosition position, const char *value, size_t length
42754275
}
42764276
position = positionAfterDeletion;
42774277

4278+
const int linesTotal = pdoc->LinesTotal();
42784279
std::string convertedText = Document::TransformLineEnds(value, lengthValue, pdoc->eolMode);
42794280

42804281
if (rectangular) {
@@ -4292,6 +4293,9 @@ void Editor::DropAt(SelectionPosition position, const char *value, size_t length
42924293
SetSelection(posAfterInsertion, position);
42934294
}
42944295
}
4296+
if (pdoc->LinesTotal() != linesTotal) {
4297+
NotifyLineCountChanged();
4298+
}
42954299
} else if (inDragDrop == ddDragging) {
42964300
SetEmptySelection(position);
42974301
}

0 commit comments

Comments
 (0)