From 976ab26a273a32edb6c56dc69978c2fc31d205e2 Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Sun, 26 Jun 2011 16:47:53 +0900 Subject: [PATCH] Support incremental and normal search on recent versions of Eclipse and forward incremental search on Notepad++. This change is derived from work by Harold Bamford . --- xkeymacsdll/Commands.cpp | 21 ++++++++++++++++++++- xkeymacsdll/Commands.h | 1 + xkeymacsdll/Utils.cpp | 8 ++++++++ xkeymacsdll/Utils.h | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/xkeymacsdll/Commands.cpp b/xkeymacsdll/Commands.cpp index 7a843c2..b96ab06 100644 --- a/xkeymacsdll/Commands.cpp +++ b/xkeymacsdll/Commands.cpp @@ -392,6 +392,16 @@ void CCommands::AdSdKduSuAu(BYTE bVk1) CXkeymacsDll::SetModifierState(before, SHIFT | META); } +void CCommands::AdCdKduCuAu(BYTE bVk1) +{ + UINT before = CXkeymacsDll::GetModifierState(); + CXkeymacsDll::SetModifierState(CONTROL | META, before); + + CXkeymacsDll::Kdu(bVk1, m_nNumericArgument); + + CXkeymacsDll::SetModifierState(before, CONTROL | META); +} + // C-a: Home int CCommands::BeginningOfLine() { @@ -2373,7 +2383,16 @@ int CCommands::Search(SEARCH_DIRECTION direction) } m_SearchDirection = direction; - OpenFindDialog(); + if (CUtils::IsNotepadPP()) { + if (direction == FORWARD) // only forward incremental search supported + AdCdKduCuAu('I'); + } else if (CUtils::IsEclipse()) { + if (direction == FORWARD) + CdKduCu('J'); + else + CdSdKduSuCu('J'); + } else + OpenFindDialog(); } else { // CUtils::Log(_T("Find Dialog is opened.")); diff --git a/xkeymacsdll/Commands.h b/xkeymacsdll/Commands.h index 042b319..90ba878 100644 --- a/xkeymacsdll/Commands.h +++ b/xkeymacsdll/Commands.h @@ -233,6 +233,7 @@ private: static void AdSdKduSuAu(BYTE bVk1); static void AdKduAu(BYTE bVk1, BYTE bVk2 = 0, BYTE bVk3 = 0); static void CdKduCu(BYTE bVk1, BYTE bVk2 = 0); + static void AdCdKduCuAu(BYTE bVk); static void Kdu(BYTE bVk1, BYTE bVk2 = 0, BYTE bVk3 = 0, BYTE bVk4 = 0); static DWORD m_nNumericArgument; static void Su(); diff --git a/xkeymacsdll/Utils.cpp b/xkeymacsdll/Utils.cpp index 2425918..f3e86ea 100644 --- a/xkeymacsdll/Utils.cpp +++ b/xkeymacsdll/Utils.cpp @@ -140,6 +140,11 @@ BOOL CUtils::IsNotepad() return !_tcsicmp(m_szApplicationName, _T("notepad.exe")); } +BOOL CUtils::IsNotepadPP() +{ + return !_tcsicmp(m_szApplicationName, _T("notepad++.exe")); +} + BOOL CUtils::IsOpera() { return !_tcsicmp(m_szApplicationName, _T("opera.exe")); @@ -793,6 +798,9 @@ BOOL CUtils::IsVisualBasicEditor() BOOL CUtils::IsEclipse() { + if (!_tcsicmp(m_szApplicationName, _T("eclipse.exe"))) + return TRUE; + TCHAR szWindowText[WINDOW_TEXT_LENGTH] = {'\0'}; GetWindowText(GetForegroundWindow(), szWindowText, sizeof(szWindowText)); diff --git a/xkeymacsdll/Utils.h b/xkeymacsdll/Utils.h index 73b76d8..754fbe8 100644 --- a/xkeymacsdll/Utils.h +++ b/xkeymacsdll/Utils.h @@ -100,6 +100,7 @@ public: static BOOL IsOutlook(); static BOOL IsOpera(); static BOOL IsNotepad(); + static BOOL IsNotepadPP(); static BOOL IsNetscape(); static BOOL IsMuleForWin32(); static BOOL IsMozilla(); -- 2.11.0