Add new items to top.
(This summarizes all changes to all files under Src, including Src\Languages.)
+2006-07-31 Kimmo
+ PATCH: [ 1531293 ] Fix wrong cursor position after find
+ Src: ccrystaltextview.cpp ccrystaltextview.h cfindtextdlg.cpp
+
2006-07-30 Takashi
BUG: [ 1528322 ] Crash when using F6 / Bugg for file differences
Src: MergeEditView.cpp
return -1;
}
+/**
+ * @brief Select text in editor.
+ * @param [in] ptStartPos Star position for highlight.
+ * @param [in] nLength Count of characters to highlight.
+ * @param [in] bCursorToLeft If TRUE cursor is positioned to Left-end of text
+ * selection, if FALSE cursor is positioned to right-end.
+ */
BOOL CCrystalTextView::
-HighlightText (const CPoint & ptStartPos, int nLength, BOOL bReverse /*= FALSE*/)
+HighlightText (const CPoint & ptStartPos, int nLength,
+ BOOL bCursorToLeft /*= FALSE*/)
{
ASSERT_VALIDTEXTPOS (ptStartPos);
CPoint ptEndPos = ptStartPos;
}
ASSERT_VALIDTEXTPOS (m_ptCursorPos); // Probably 'nLength' is bigger than expected...
- m_ptCursorPos = bReverse ? ptStartPos : ptEndPos;
+ m_ptCursorPos = bCursorToLeft ? ptStartPos : ptEndPos;
m_ptAnchor = m_ptCursorPos;
SetSelection (ptStartPos, ptEndPos);
UpdateCaret ();
BOOL FindText (LPCTSTR pszText, const CPoint & ptStartPos, DWORD dwFlags, BOOL bWrapSearch, CPoint * pptFoundPos);
BOOL FindTextInBlock (LPCTSTR pszText, const CPoint & ptStartPos, const CPoint & ptBlockBegin, const CPoint & ptBlockEnd,
DWORD dwFlags, BOOL bWrapSearch, CPoint * pptFoundPos);
- BOOL HighlightText (const CPoint & ptStartPos, int nLength, BOOL bReverse = FALSE);
+ BOOL HighlightText (const CPoint & ptStartPos, int nLength,
+ BOOL bCursorToLeft = FALSE);
- // IME (input method editor)
+ // IME (input method editor)
void UpdateCompositionWindowPos();
void UpdateCompositionWindowFont();
/////////////////////////////////////////////////////////////////////////////
// CFindTextDlg dialog
-CFindTextDlg::CFindTextDlg (CCrystalTextView * pBuddy):CDialog (CFindTextDlg::IDD, NULL)
+CFindTextDlg::CFindTextDlg (CCrystalTextView * pBuddy)
+: CDialog (CFindTextDlg::IDD, NULL)
+, m_pBuddy(pBuddy)
+, m_nDirection(1)
+, m_bMatchCase(FALSE)
+, m_bWholeWord(FALSE)
+, m_bRegExp(FALSE)
+, m_ptCurrentPos(CPoint (0, 0))
{
- m_pBuddy = pBuddy;
//{{AFX_DATA_INIT(CFindTextDlg)
- m_nDirection = 1;
- m_bMatchCase = FALSE;
- m_bWholeWord = FALSE;
- m_bRegExp = FALSE;
//}}AFX_DATA_INIT
- m_ptCurrentPos = CPoint (0, 0);
}
void CFindTextDlg::
UpdateLastSearch ();
ASSERT (m_pBuddy != NULL);
+ BOOL bCursorToLeft = FALSE;
DWORD dwSearchFlags = 0;
if (m_bMatchCase)
dwSearchFlags |= FIND_MATCH_CASE;
if (m_bRegExp)
dwSearchFlags |= FIND_REGEXP;
if (m_nDirection == 0)
- dwSearchFlags |= FIND_DIRECTION_UP;
+ {
+ dwSearchFlags |= FIND_DIRECTION_UP;
+ // When finding upwards put cursor to begin of selection
+ bCursorToLeft = TRUE;
+ }
m_ctlFindText.SaveState(_T("Files\\FindInFile"));
CPoint ptTextPos;
- if (!m_pBuddy->FindText (m_sText, m_ptCurrentPos, dwSearchFlags, TRUE, &ptTextPos))
+ if (!m_pBuddy->FindText (m_sText, m_ptCurrentPos, dwSearchFlags, TRUE,
+ &ptTextPos))
{
CString prompt;
prompt.Format (IDS_EDIT_TEXT_NOT_FOUND, m_sText);
return;
}
- // Goto begin of selection if scrolling happens to left
- BOOL bReverse = FALSE;
- if (ptTextPos.x < m_ptCurrentPos.x)
- bReverse = TRUE;
-
- m_pBuddy->HighlightText (ptTextPos, m_pBuddy->m_nLastFindWhatLen, bReverse);
+ m_pBuddy->HighlightText (ptTextPos, m_pBuddy->m_nLastFindWhatLen,
+ bCursorToLeft);
CDialog::OnOK ();
}