summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-09-16 13:28:48 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-09-16 13:28:48 +0300
commit4c5b3c05d58b815ade3fa0cb88aea48dbeabc04f (patch)
tree8e419391f922e5e3e3c72679ba15c65510504430 /src/mir_app
parent995bdd0b21843955075c5e6e9c6bcf47b2cc3ae7 (diff)
fixes #2063 (TabSRMM offers to search only for last word)
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/srmm_base.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp
index 8fa4a7864d..350f40ef20 100644
--- a/src/mir_app/src/srmm_base.cpp
+++ b/src/mir_app/src/srmm_base.cpp
@@ -205,21 +205,19 @@ LRESULT CSrmmBaseDialog::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam)
wchar_t *pszWord = (wchar_t*)_alloca(8192);
pszWord[0] = '\0';
- int iCharIndex = m_log.SendMsg(EM_CHARFROMPOS, 0, (LPARAM)&ptl);
- if (iCharIndex < 0)
- break;
-
- int start = m_log.SendMsg(EM_FINDWORDBREAK, WB_LEFT, iCharIndex);
- int end = m_log.SendMsg(EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);
+ if (sel.cpMin == sel.cpMax) { // get a word under cursor
+ int iCharIndex = m_log.SendMsg(EM_CHARFROMPOS, 0, (LPARAM)& ptl);
+ if (iCharIndex < 0)
+ break;
- if (end - start > 0) {
- CHARRANGE cr;
- cr.cpMin = start;
- cr.cpMax = end;
+ sel.cpMin = m_log.SendMsg(EM_FINDWORDBREAK, WB_LEFT, iCharIndex);
+ sel.cpMax = m_log.SendMsg(EM_FINDWORDBREAK, WB_RIGHT, iCharIndex);
+ }
+ if (sel.cpMax > sel.cpMin) {
TEXTRANGE tr = { 0 };
- tr.chrg = cr;
- tr.lpstrText = (wchar_t*)pszWord;
+ tr.chrg = sel;
+ tr.lpstrText = pszWord;
int iRes = m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr);
if (iRes > 0) {
wchar_t *p = wcschr(pszWord, '\r');