diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 9baa021613a6..df9d1f86410d 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -360,10 +360,14 @@ void Notepad_plus::command(int id) HWND focusedHwnd = ::GetFocus(); if (focusedHwnd == _pEditView->getHSelf()) { - if (!_pEditView->hasSelection()) // Ctrl + X: without selected text, it will cut the whole line. - _pEditView->execute(SCI_LINECUT); - else + if (_pEditView->hasSelection()) _pEditView->execute(WM_CUT); + else + { + bool useLinCopyCut = (NppParameters::getInstance()).useLineCopyCutDelete(); + if (useLinCopyCut) + _pEditView->execute(SCI_LINECUT); // Ctrl + X: without selected text, it will cut the whole line. + } } break; } @@ -373,10 +377,14 @@ void Notepad_plus::command(int id) HWND focusedHwnd = ::GetFocus(); if (focusedHwnd == _pEditView->getHSelf()) { - if (!_pEditView->hasSelection()) // Ctrl + C: without selected text, it will copy the whole line. - _pEditView->execute(SCI_LINECOPY); - else + if (_pEditView->hasSelection()) _pEditView->execute(WM_COPY); + else + { + bool useLinCopyCut = (NppParameters::getInstance()).useLineCopyCutDelete(); + if (useLinCopyCut) + _pEditView->execute(SCI_LINECOPY); // Ctrl + C: without selected text, it will copy the whole line. + } } else // Search result { diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index fce6343573b0..fa42bbdd4511 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -1663,18 +1663,19 @@ bool NppParameters::load() _column2MultiSelect = false; } - //-------------------------------------------------------------// - // disableHardCodedShiftDelete.xml // - // This empty xml file is optional - user adds this empty file // - // manually in order to prevent hard coded Shift-DEL shortcut // - // delete whole line while no selection. // - //-------------------------------------------------------------// - std::wstring disableHardCodedShiftDeletePath = _userPath; - pathAppend(disableHardCodedShiftDeletePath, TEXT("disableHardCodedShiftDelete.xml")); - - if (PathFileExists(disableHardCodedShiftDeletePath.c_str())) - { - _useHardCodedShiftDelete = false; + //----------------------------------------------------------------------------------// + // disableLineCopyCutDelete.xml // + // This empty xml file is optional - user adds this empty file manually to prevent: // + // 1. Hard coded Shift-DEL shortcut delete whole line while no selection. // + // 2. Copy command (Ctrl-C) copy whole line (without selection). // + // 3. Cut command (Ctrl-X) cut whole line (without selection). // + //----------------------------------------------------------------------------------// + std::wstring disableLineCopyCutDeletePath = _userPath; + pathAppend(disableLineCopyCutDeletePath, TEXT("disableLineCopyCutDelete.xml")); + + if (PathFileExists(disableLineCopyCutDeletePath.c_str())) + { + _useLineCopyCutDelete = false; } return isAllLaoded; diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 517aecbc11fe..0834f5deb22a 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -1878,7 +1878,7 @@ class NppParameters final bool isSelectFgColorEnabled() const { return _isSelectFgColorEnabled; }; bool isRegForOSAppRestartDisabled() const { return _isRegForOSAppRestartDisabled; }; bool doColumn2MultiSelect() const { return _column2MultiSelect; }; - bool useHardCodedShiftDelete() const { return _useHardCodedShiftDelete; }; + bool useLineCopyCutDelete() const { return _useLineCopyCutDelete; }; private: bool _isAnyShortcutModified = false; @@ -1947,7 +1947,7 @@ class NppParameters final bool _isSelectFgColorEnabled = false; bool _isRegForOSAppRestartDisabled = false; bool _column2MultiSelect = true; - bool _useHardCodedShiftDelete = true; + bool _useLineCopyCutDelete = true; bool _doNppLogNetworkDriveIssue = false; bool _doNppLogNulContentCorruptionIssue = false; diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index ea9700676867..e238d96a726e 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -525,7 +525,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa SHORT shift = GetKeyState(VK_SHIFT); bool isColumnSelection = (execute(SCI_GETSELECTIONMODE) == SC_SEL_RECTANGLE) || (execute(SCI_GETSELECTIONMODE) == SC_SEL_THIN); bool column2MultSelect = (NppParameters::getInstance()).doColumn2MultiSelect(); - bool useHardCodedShiftDelete = (NppParameters::getInstance()).useHardCodedShiftDelete(); + bool useHardCodedShiftDelete = (NppParameters::getInstance()).useLineCopyCutDelete(); if (wParam == VK_DELETE) {