diff options
author | George Hazan <george.hazan@gmail.com> | 2023-06-19 17:54:32 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-06-19 17:54:32 +0300 |
commit | 1c3bbb283ca5f0d25658e190c4c41a4667f71ff2 (patch) | |
tree | 892c6964b7d7c4bd572fbdb9dc8736605471d6c6 /src | |
parent | 7c711561aa5a124b51df2c1cba138eb518e6aad6 (diff) |
nick search went to core
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 39cc182ea2..0696dbbe4c 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -482,6 +482,44 @@ LRESULT CSrmmBaseDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam if (auto *ui = (USERINFO *)m_nickList.GetItemData(index))
Chat_DoEventHook(m_si, GC_USER_PRIVMESS, ui, nullptr, 0);
}
+
+ if (wParam == VK_ESCAPE || wParam == VK_UP || wParam == VK_DOWN || wParam == VK_NEXT || wParam == VK_PRIOR || wParam == VK_TAB || wParam == VK_HOME || wParam == VK_END) {
+ m_wszNickSearch.Empty();
+ m_iNickSearch = -1;
+ }
+ break;
+
+
+ case WM_SETFOCUS:
+ case WM_KILLFOCUS:
+ m_wszNickSearch.Empty();
+ m_iNickSearch = -1;
+ break;
+
+ case WM_CHAR:
+ case WM_UNICHAR:
+ // simple incremental search for the user (nick) - list control
+ // typing esc or movement keys will clear the current search string
+ if (wParam == 27 && !m_wszNickSearch.IsEmpty()) { // escape - reset everything
+ m_wszNickSearch.Empty();
+ m_iNickSearch = -1;
+ break;
+ }
+ if (wParam == '\b' && !m_wszNickSearch.IsEmpty()) // backspace
+ m_wszNickSearch.Truncate(m_wszNickSearch.GetLength() - 1);
+ else if (wParam < ' ')
+ break;
+ else
+ m_wszNickSearch.AppendChar((wchar_t)wParam);
+
+ if (!m_wszNickSearch.IsEmpty()) {
+ m_iNickSearch = m_nickList.SendMsg(LB_FINDSTRING, -1, LPARAM(m_wszNickSearch.c_str()));
+ if (m_iNickSearch == LB_ERR) {
+ MessageBeep(MB_OK);
+ m_wszNickSearch.Truncate(m_wszNickSearch.GetLength() - 1);
+ return 0;
+ }
+ }
break;
}
|