* Search of a text in the document, in the given range. * @return The position of the found text, -1 if not found. */
| 5952 | * @return The position of the found text, -1 if not found. |
| 5953 | */ |
| 5954 | long Editor::FindText ( |
| 5955 | uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, |
| 5956 | ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. |
| 5957 | sptr_t lParam ) ///< @c TextToFind structure: The text to search for in the given range. |
| 5958 | { |
| 5959 | Sci_TextToFind *ft = reinterpret_cast<Sci_TextToFind *> ( lParam ); |
| 5960 | int lengthFound = istrlen ( ft->lpstrText ); |
| 5961 | if ( !pdoc->HasCaseFolder() ) { |
| 5962 | pdoc->SetCaseFolder ( CaseFolderForEncoding() ); |
| 5963 | } |
| 5964 | int pos = pdoc->FindText ( ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, |
| 5965 | ( wParam & SCFIND_MATCHCASE ) != 0, |
| 5966 | ( wParam & SCFIND_WHOLEWORD ) != 0, |
| 5967 | ( wParam & SCFIND_WORDSTART ) != 0, |
| 5968 | ( wParam & SCFIND_REGEXP ) != 0, |
| 5969 | wParam, |
| 5970 | &lengthFound ); |
| 5971 | if ( pos != -1 ) { |
| 5972 | ft->chrgText.cpMin = pos; |
| 5973 | ft->chrgText.cpMax = pos + lengthFound; |
| 5974 | } |
| 5975 | return pos; |
| 5976 | } |
| 5977 | |
| 5978 | /** |
| 5979 | * Relocatable search support : Searches relative to current selection |
no test coverage detected