MCPcopy Create free account
hub / github.com/ProgerXP/Notepad2e / EditFindNext

Function EditFindNext

src/Edit.c:4759–4805  ·  view source on GitHub ↗

============================================================================= EditFindNext()

Source from the content-addressed store, hash-verified

4757// EditFindNext()
4758//
4759BOOL EditFindNext ( HWND hwnd, LPCEDITFINDREPLACE lpefr, BOOL fExtendSelection )
4760{
4761 struct TextToFind ttf;
4762 int iPos;
4763 int iSelPos, iSelAnchor;
4764 char szFind2[512];
4765 BOOL bSuppressNotFound = FALSE;
4766 if ( !lstrlenA ( lpefr->szFind ) ) {
4767 return /*EditFindReplaceDlg(hwnd,lpefr,FALSE)*/FALSE;
4768 }
4769 lstrcpynA ( szFind2, lpefr->szFind, COUNTOF ( szFind2 ) );
4770 if ( lpefr->bTransformBS )
4771 TransformBackslashes ( szFind2, ( lpefr->fuFlags & SCFIND_REGEXP ),
4772 ( UINT ) SendMessage ( hwnd, SCI_GETCODEPAGE, 0, 0 ) );
4773 if ( lstrlenA ( szFind2 ) == 0 ) {
4774 InfoBox ( 0, L"MsgNotFound", IDS_NOTFOUND );
4775 return FALSE;
4776 }
4777 iSelPos = ( int ) SendMessage ( hwnd, SCI_GETCURRENTPOS, 0, 0 );
4778 iSelAnchor = ( int ) SendMessage ( hwnd, SCI_GETANCHOR, 0, 0 );
4779 ZeroMemory ( &ttf, sizeof ( ttf ) );
4780 ttf.chrg.cpMin = ( int ) SendMessage ( hwnd, SCI_GETSELECTIONEND, 0, 0 );
4781 ttf.chrg.cpMax = ( int ) SendMessage ( hwnd, SCI_GETLENGTH, 0, 0 );
4782 ttf.lpstrText = szFind2;
4783 iPos = ( int ) SendMessage ( hwnd, SCI_FINDTEXT, lpefr->fuFlags, ( LPARAM ) &ttf );
4784 if ( iPos == -1 && ttf.chrg.cpMin > 0 && !lpefr->bNoFindWrap && !fExtendSelection ) {
4785 if ( IDOK == InfoBox ( MBOKCANCEL, L"MsgFindWrap1", IDS_FIND_WRAPFW ) ) {
4786 ttf.chrg.cpMin = 0;
4787 iPos = ( int ) SendMessage ( hwnd, SCI_FINDTEXT, lpefr->fuFlags, ( LPARAM ) &ttf );
4788 } else {
4789 bSuppressNotFound = TRUE;
4790 }
4791 }
4792 if ( iPos == -1 ) {
4793 // notfound
4794 if ( !bSuppressNotFound ) {
4795 InfoBox ( 0, L"MsgNotFound", IDS_NOTFOUND );
4796 }
4797 return FALSE;
4798 }
4799 if ( !fExtendSelection ) {
4800 EditSelectEx ( hwnd, ttf.chrgText.cpMin, ttf.chrgText.cpMax );
4801 } else {
4802 EditSelectEx ( hwnd, min ( iSelAnchor, iSelPos ), ttf.chrgText.cpMax );
4803 }
4804 return TRUE;
4805}
4806
4807
4808//=============================================================================

Callers 3

EditFindReplaceDlgProcWFunction · 0.85
InitInstanceFunction · 0.85
MsgCommandFunction · 0.85

Calls 3

TransformBackslashesFunction · 0.85
InfoBoxFunction · 0.85
EditSelectExFunction · 0.85

Tested by

no test coverage detected