Fix "cut last line" (orig issue #5051)

This commit is contained in:
METANEOCORTEX\Kotti 2023-11-16 23:43:30 +01:00
parent 489b4c1e4b
commit fcf3025d64

View File

@ -2954,7 +2954,7 @@ void EditCutLines(HWND hwnd, const bool bMSBehavSelEmpty)
if (!Sci_IsMultiOrRectangleSelection())
{
bool const bInLastLine = Sci_InLastLine();
bool const bClearCB = bInLastLine ? (Sci_GetNetLineLength(Sci_GetCurrentLineNumber()) == 0) : false;
bool const bIsLineEmpty = Sci_GetNetLineLength(Sci_GetCurrentLineNumber()) == 0;
UndoTransActionBegin();
if (SciCall_IsSelectionEmpty() && bMSBehavSelEmpty) {
SciCall_CopyAllowLine(); // (!) VisualStudio behavior
@ -2969,11 +2969,9 @@ void EditCutLines(HWND hwnd, const bool bMSBehavSelEmpty)
SciCall_Home();
}
EndUndoTransAction();
if (bInLastLine) {
if (bClearCB) {
EditClearClipboard(hwnd);
}
EditAppendToClipboard(hwnd, "", 0); // adds EOL instead of EOF
if (bInLastLine && bIsLineEmpty) {
EditClearClipboard(hwnd);
EditAppendToClipboard(hwnd, "", 0); // adds EOL
}
return;
}