Browse Source

Fix Ctrl-C not doing copy from Search result issue

Solution from: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/15739#issuecomment-2479671245

Fix #15739, close #15810
pull/15813/head
Don Ho 5 days ago
parent
commit
c24444acfe
  1. 1
      PowerEditor/installer/nativeLang/abkhazian.xml
  2. 1
      PowerEditor/installer/nativeLang/russian.xml
  3. 27
      PowerEditor/src/Notepad_plus.cpp
  4. 4
      PowerEditor/src/NppBigSwitch.cpp
  5. 4
      PowerEditor/src/NppCommands.cpp
  6. 21
      PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp
  7. 13
      PowerEditor/src/ScintillaComponent/FindReplaceDlg.h
  8. 2
      PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp
  9. 2
      PowerEditor/src/ScintillaComponent/columnEditor.cpp
  10. 4
      PowerEditor/src/WinControls/AnsiCharPanel/ansiCharPanel.cpp
  11. 2
      PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp
  12. 2
      PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp
  13. 2
      PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp
  14. 4
      PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
  15. 36
      PowerEditor/src/WinControls/Window.h

1
PowerEditor/installer/nativeLang/abkhazian.xml

@ -1484,7 +1484,6 @@ Updated to v8.2.1:
<find-result-title-info-selections value="($INT_REPLACE1$ аиқәшәарақәа $INT_REPLACE2$ аҟны иалкаақәоу $INT_REPLACE3$ рҟынтәи)"/>
<find-result-title-info-extra value=" - Ацәаҳәақәа рФильтр Арежим: иаанарԥшуеит афильтрра алҵшәақәа мацара"/>
<find-result-hits value="(Аиқәшәарақәа $INT_REPLACE$)"/>
<find-result-hits-and-line-hits value="($INT_REPLACE1$ аиқәшәарақәа ацәаҳәақәа $INT_REPLACE2$ рҟны)"/>
<find-regex-zero-length-match value="ноль аура змоу аиқәшәара"/>
<session-save-folder-as-workspace value="Еиқәырхатәуп Акаталог Апроект ҳасабла"/>
<tab-untitled-string value="аҿыц "/>

1
PowerEditor/installer/nativeLang/russian.xml

@ -1762,7 +1762,6 @@ Notepad++ сделает резервную копию вашего старог
<find-result-title-info-selections value="(найдено $INT_REPLACE1$ совпадений в $INT_REPLACE2$ выделениях из $INT_REPLACE3$)"/>
<find-result-title-info-extra value=" - Режим Фильтрации Строк: только отображает результаты фильтрования"/>
<find-result-hits value="(совпадений: $INT_REPLACE$)"/>
<find-result-hits-and-line-hits value="($INT_REPLACE1$ совпадений в $INT_REPLACE2$ строках)"/>
<find-regex-zero-length-match value="совпадение нулевой длины"/>
<session-save-folder-as-workspace value="Сохранить Папку как Проект"/>
<tab-untitled-string value="новый "/>

27
PowerEditor/src/Notepad_plus.cpp

@ -880,7 +880,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
activateBuffer(_mainEditView.getCurrentBufferID(), MAIN_VIEW);
activateBuffer(_subEditView.getCurrentBufferID(), SUB_VIEW);
_mainEditView.getFocus();
_mainEditView.grabFocus();
return TRUE;
}
@ -2566,7 +2566,20 @@ void Notepad_plus::checkClipboard()
if (!NppParameters::getInstance().getSVP()._lineCopyCutWithoutSelection)
{
enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR);
enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR);
if (hasSelection)
{
enableCommand(IDM_EDIT_COPY, true, MENU | TOOLBAR);
}
else if (_findReplaceDlg.allowCopyAction())
{
enableCommand(IDM_EDIT_COPY, false, TOOLBAR);
enableCommand(IDM_EDIT_COPY, true, MENU);
}
else
{
enableCommand(IDM_EDIT_COPY, false, MENU | TOOLBAR);
}
}
enableCommand(IDM_EDIT_PASTE, canPaste, MENU | TOOLBAR);
enableCommand(IDM_EDIT_DELETE, hasSelection, MENU | TOOLBAR);
@ -4752,7 +4765,7 @@ int Notepad_plus::switchEditViewTo(int gid)
if (currentView() == gid)
{
//make sure focus is ok, then leave
_pEditView->getFocus(); //set the focus
_pEditView->grabFocus(); //set the focus
return gid;
}
@ -4768,7 +4781,7 @@ int Notepad_plus::switchEditViewTo(int gid)
std::swap(_pEditView, _pNonEditView);
_pEditView->beSwitched();
_pEditView->getFocus(); //set the focus
_pEditView->grabFocus(); //set the focus
if (_pDocMap)
{
@ -5939,7 +5952,7 @@ void Notepad_plus::fullScreenToggle()
int y = nppRect.top;
::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE);
_pEditView->getFocus();
_pEditView->grabFocus();
}
else //toggle fullscreen off
{
@ -6073,7 +6086,7 @@ void Notepad_plus::postItToggle()
int y = nppRect.top + 1;
::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE);
_pEditView->getFocus();
_pEditView->grabFocus();
}
else //PostIt enabled, disable it
{
@ -7697,7 +7710,7 @@ void Notepad_plus::launchDocMap()
_pDocMap->wrapMap();
_pDocMap->display();
_pEditView->getFocus();
_pEditView->grabFocus();
}

4
PowerEditor/src/NppBigSwitch.cpp

@ -2257,7 +2257,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
{
if (wParam != WA_INACTIVE && _pEditView && _pNonEditView)
{
_pEditView->getFocus();
_pEditView->grabFocus();
auto x = _pEditView->execute(SCI_GETXOFFSET);
_pEditView->execute(SCI_SETXOFFSET, x);
x = _pNonEditView->execute(SCI_GETXOFFSET);
@ -2880,7 +2880,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
//case WM_LBUTTONDBLCLK:
case WM_LBUTTONUP :
{
_pEditView->getFocus();
_pEditView->grabFocus();
::ShowWindow(hwnd, SW_SHOW);
_dockingManager.showFloatingContainers(true);
restoreMinimizeDialogs();

4
PowerEditor/src/NppCommands.cpp

@ -895,7 +895,7 @@ void Notepad_plus::command(int id)
{
if (_pDocumentListPanel && _pDocumentListPanel->isVisible())
{
_pDocumentListPanel->getFocus();
_pDocumentListPanel->grabFocus();
}
else
{
@ -1035,7 +1035,7 @@ void Notepad_plus::command(int id)
{
if (_pFuncList && _pFuncList->isVisible())
{
_pFuncList->getFocus();
_pFuncList->grabFocus();
}
else
{

21
PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp

@ -577,10 +577,15 @@ bool Finder::notify(SCNotification *notification)
case SCN_PAINTED :
if (isDoubleClicked)
{
(*_ppEditView)->getFocus();
(*_ppEditView)->grabFocus();
isDoubleClicked = false;
}
break;
case SCN_UPDATEUI:
::SendMessage(_hParent, NPPM_INTERNAL_CHECKUNDOREDOSTATE, 0, 0);
break;
}
return false;
}
@ -2352,7 +2357,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
setStatusbarMessage(result, FSMessage, reasonMsg);
}
getFocus();
grabFocus();
}
}
return TRUE;
@ -2401,7 +2406,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
if (isMacroRecording)
saveInMacro(wParam, FR_OP_FIND);
getFocus();
grabFocus();
}
}
return TRUE;
@ -2451,7 +2456,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
setStatusbarMessage(result, FSMessage, reasonMsg);
}
getFocus();
grabFocus();
}
}
return TRUE;
@ -2874,7 +2879,7 @@ bool FindReplaceDlg::processFindNext(const wchar_t *txt2find, const FindOption *
// if the dialog is not shown, pass the focus to his parent(ie. Notepad++)
if (!::IsWindowVisible(_hSelf))
{
(*_ppEditView)->getFocus();
(*_ppEditView)->grabFocus();
}
else
{
@ -3676,7 +3681,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
{
// Show finder
_pFinder->display();
getFocus(); // no hits
grabFocus(); // no hits
}
}
else // error - search folder doesn't exist
@ -3776,7 +3781,7 @@ Finder * FindReplaceDlg::createFinder()
// Show finder
pFinder->display();
pFinder->_scintView.getFocus();
pFinder->_scintView.grabFocus();
return pFinder;
}
@ -5905,7 +5910,7 @@ intptr_t CALLBACK FindIncrementDlg::run_dlgProc(UINT message, WPARAM wParam, LPA
{
case IDCANCEL :
(*(_pFRDlg->_ppEditView))->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_INC);
(*(_pFRDlg->_ppEditView))->getFocus();
(*(_pFRDlg->_ppEditView))->grabFocus();
display(false);
return TRUE;

13
PowerEditor/src/ScintillaComponent/FindReplaceDlg.h

@ -352,10 +352,21 @@ public :
if (_pFinder)
{
_pFinder->display();
_pFinder->_scintView.getFocus();
_pFinder->_scintView.grabFocus();
}
};
bool allowCopyAction() {
HWND focusedHwnd = GetFocus();
Finder* finder = getFinderFrom(focusedHwnd);
if (finder)
{
return finder->_scintView.hasSelection();
}
return false;
};
HWND getHFindResults() {
if (_pFinder)
return _pFinder->_scintView.getHSelf();

2
PowerEditor/src/ScintillaComponent/GoToLineDlg.cpp

@ -118,7 +118,7 @@ intptr_t CALLBACK GoToLineDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
notification.nmhdr.idFrom = ::GetDlgCtrlID(_hSelf);
::SendMessage(_hParent, WM_NOTIFY, LINKTRIGGERED, reinterpret_cast<LPARAM>(&notification));
(*_ppEditView)->getFocus();
(*_ppEditView)->grabFocus();
return TRUE;
}

2
PowerEditor/src/ScintillaComponent/columnEditor.cpp

@ -353,7 +353,7 @@ intptr_t CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
}
}
(*_ppEditView)->execute(SCI_ENDUNDOACTION);
(*_ppEditView)->getFocus();
(*_ppEditView)->grabFocus();
return TRUE;
}
case IDC_COL_TEXT_RADIO :

4
PowerEditor/src/WinControls/AnsiCharPanel/ansiCharPanel.cpp

@ -176,7 +176,7 @@ void AnsiCharPanel::insertChar(unsigned char char2insert) const
(*_ppEditView)->execute(SCI_REPLACESEL, 0, reinterpret_cast<LPARAM>(""));
size_t len = (char2insert < 128) ? 1 : strlen(multiByteStr);
(*_ppEditView)->execute(SCI_ADDTEXT, len, reinterpret_cast<LPARAM>(multiByteStr));
(*_ppEditView)->getFocus();
(*_ppEditView)->grabFocus();
}
void AnsiCharPanel::insertString(LPWSTR string2insert) const
@ -203,5 +203,5 @@ void AnsiCharPanel::insertString(LPWSTR string2insert) const
(*_ppEditView)->execute(SCI_REPLACESEL, 0, reinterpret_cast<LPARAM>(""));
size_t len = strlen(multiByteStr);
(*_ppEditView)->execute(SCI_ADDTEXT, len, reinterpret_cast<LPARAM>(multiByteStr));
(*_ppEditView)->getFocus();
(*_ppEditView)->grabFocus();
}

2
PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp

@ -287,7 +287,7 @@ intptr_t CALLBACK ClipboardHistoryPanel::run_dlgProc(UINT message, WPARAM wParam
(*_ppEditView)->execute(SCI_REPLACESEL, 0, reinterpret_cast<LPARAM>(""));
(*_ppEditView)->execute(SCI_ADDTEXT, strlen(c), reinterpret_cast<LPARAM>(c));
(*_ppEditView)->getFocus();
(*_ppEditView)->grabFocus();
delete[] c;
}
}

2
PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp

@ -1008,7 +1008,7 @@ bool WordStyleDlg::goToSection(const wchar_t* sectionNames)
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_SETCURSEL, i, 0);
setVisualFromStyleList();
getFocus();
grabFocus();
return true;
}

2
PowerEditor/src/WinControls/FileBrowser/fileBrowser.cpp

@ -449,7 +449,7 @@ bool FileBrowser::selectItemFromPath(const wstring& itemPath) const
if (foundItem)
{
_treeView.selectItem(foundItem);
_treeView.getFocus();
_treeView.grabFocus();
return true;
}
}

4
PowerEditor/src/WinControls/Preference/preferenceDlg.cpp

@ -104,7 +104,7 @@ bool PreferenceDlg::goToSection(size_t iPage, intptr_t ctrlID)
{
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_SETCURSEL, iPage, 0);
showDialogByIndex(iPage);
getFocus();
grabFocus();
if (ctrlID != -1)
{
@ -2047,7 +2047,7 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
}
NppDarkMode::refreshDarkMode(_hSelf, forceRefresh);
getFocus(); // to make black mode title bar appear
grabFocus(); // to make black mode title bar appear
return TRUE;
}

36
PowerEditor/src/WinControls/Window.h

@ -29,61 +29,52 @@ public:
//@}
virtual void init(HINSTANCE hInst, HWND parent)
{
virtual void init(HINSTANCE hInst, HWND parent) {
_hInst = hInst;
_hParent = parent;
}
virtual void destroy() = 0;
virtual void display(bool toShow = true) const
{
virtual void display(bool toShow = true) const {
::ShowWindow(_hSelf, toShow ? SW_SHOW : SW_HIDE);
}
virtual void reSizeTo(RECT & rc) // should NEVER be const !!!
{
virtual void reSizeTo(RECT & rc) { // should NEVER be const !!!
::MoveWindow(_hSelf, rc.left, rc.top, rc.right, rc.bottom, TRUE);
redraw();
}
virtual void reSizeToWH(RECT& rc) // should NEVER be const !!!
{
virtual void reSizeToWH(RECT& rc) { // should NEVER be const !!!
::MoveWindow(_hSelf, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
redraw();
}
virtual void redraw(bool forceUpdate = false) const
{
virtual void redraw(bool forceUpdate = false) const {
::InvalidateRect(_hSelf, nullptr, TRUE);
if (forceUpdate)
::UpdateWindow(_hSelf);
}
virtual void getClientRect(RECT & rc) const
{
virtual void getClientRect(RECT & rc) const {
::GetClientRect(_hSelf, &rc);
}
virtual void getWindowRect(RECT & rc) const
{
virtual void getWindowRect(RECT & rc) const {
::GetWindowRect(_hSelf, &rc);
}
virtual int getWidth() const
{
virtual int getWidth() const {
RECT rc;
::GetClientRect(_hSelf, &rc);
return (rc.right - rc.left);
}
virtual int getHeight() const
{
virtual int getHeight() const {
RECT rc;
::GetClientRect(_hSelf, &rc);
if (::IsWindowVisible(_hSelf) == TRUE)
@ -96,8 +87,7 @@ public:
return (::IsWindowVisible(_hSelf)?true:false);
}
HWND getHSelf() const
{
HWND getHSelf() const {
return _hSelf;
}
@ -105,13 +95,11 @@ public:
return _hParent;
}
void getFocus() const {
void grabFocus() const {
::SetFocus(_hSelf);
}
HINSTANCE getHinst() const
{
//assert(_hInst != 0);
HINSTANCE getHinst() const {
return _hInst;
}

Loading…
Cancel
Save