From 6f24db3f13ac4f0a7e0808d36c4263c6a1f6c8d2 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 3 Mar 2013 19:52:36 +0100 Subject: [PATCH] TGitBlame: Use selected text as search string Signed-off-by: Sven Strickroth --- src/TortoiseGitBlame/TortoiseGitBlameView.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp index 3a51e26f7..77fd86d60 100644 --- a/src/TortoiseGitBlame/TortoiseGitBlameView.cpp +++ b/src/TortoiseGitBlame/TortoiseGitBlameView.cpp @@ -1753,11 +1753,22 @@ void CTortoiseGitBlameView::OnEditFind() { m_pFindDialog=new CFindReplaceDialog(); + CString oneline; + if (m_TextView.Call(SCI_GETSELECTIONSTART) != m_TextView.Call(SCI_GETSELECTIONEND)) + { + LRESULT bufsize = m_TextView.Call(SCI_GETSELECTIONEND) - m_TextView.Call(SCI_GETSELECTIONSTART); + char * linebuf = new char[bufsize + 1]; + SecureZeroMemory(linebuf, bufsize + 1); + SendEditor(SCI_GETSELTEXT, 0, (LPARAM)linebuf); + oneline = m_TextView.StringFromControl(linebuf); + delete [] linebuf; + } + DWORD flags = FR_DOWN | FR_HIDEWHOLEWORD | FR_HIDEUPDOWN; if (theApp.GetInt(_T("FindMatchCase"))) flags |= FR_MATCHCASE; - m_pFindDialog->Create(TRUE, _T(""), NULL, flags, this); + m_pFindDialog->Create(TRUE, oneline, NULL, flags, this); } void CTortoiseGitBlameView::OnEditGoto() -- 2.11.4.GIT