diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 2e44663..5483381 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -4428,95 +4428,6 @@ LRESULT WINAPI REExtendedRegisterClass(void) return result; } -int ME_AutoURLDetect(ME_TextEditor *editor, WCHAR curChar) -{ - struct prefix_s { - const char *text; - int length; - } prefixes[12] = { - {"http:", 5}, - {"file:", 6}, - {"mailto:", 8}, - {"ftp:", 5}, - {"https:", 7}, - {"gopher:", 8}, - {"nntp:", 6}, - {"prospero:", 10}, - {"telnet:", 8}, - {"news:", 6}, - {"wais:", 6}, - {"www.", 5} - }; - CHARRANGE ins_pt; - int curf_ef, link_ef, def_ef; - int cur_prefx, prefx_cnt; - int sel_min, sel_max; - int car_pos = 0; - int text_pos=-1; - int URLmin, URLmax = 0; - FINDTEXTA ft; - CHARFORMAT2W cur_format; - CHARFORMAT2W default_format; - CHARFORMAT2W link; - RichEditANSIWndProc(editor->hWnd, EM_EXGETSEL, (WPARAM) 0, (LPARAM) &ins_pt); - sel_min = ins_pt.cpMin; - sel_max = ins_pt.cpMax; - if (sel_min==sel_max) - car_pos = sel_min; - if (sel_min!=sel_max) - car_pos = ME_GetTextLength(editor)+1; - cur_format.cbSize = sizeof(cur_format); - default_format.cbSize = sizeof(default_format); - RichEditANSIWndProc(editor->hWnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM) &cur_format); - RichEditANSIWndProc(editor->hWnd, EM_GETCHARFORMAT, SCF_DEFAULT, (LPARAM) &default_format); - link.cbSize = sizeof(link); - link.dwMask = CFM_LINK; - link.dwEffects = CFE_LINK; - curf_ef = cur_format.dwEffects & link.dwEffects; - def_ef = default_format.dwEffects & link.dwEffects; - link_ef = link.dwEffects & link.dwEffects; - if (curf_ef == link_ef) - { - if( curChar == '\n' || curChar=='\r' || curChar==' ') - { - ME_SetSelection(editor, car_pos, car_pos); - RichEditANSIWndProc(editor->hWnd, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &default_format); - text_pos=-1; - return 0; - } - } - if (curf_ef == def_ef) - { - cur_prefx = 0; - prefx_cnt = (sizeof(prefixes)/sizeof(struct prefix_s))-1; - while (cur_prefx<=prefx_cnt) - { - if (text_pos == -1) - { - ft.lpstrText = prefixes[cur_prefx].text; - URLmin=max(0,(car_pos-prefixes[cur_prefx].length)); - URLmax=max(0, car_pos); - if ((car_pos == 0) && (ME_GetTextLength(editor) != 0)) - { - URLmax = ME_GetTextLength(editor)+1; - } - ft.chrg.cpMin = URLmin; - ft.chrg.cpMax = URLmax; - text_pos=RichEditANSIWndProc(editor->hWnd, EM_FINDTEXT, FR_DOWN, (LPARAM)&ft); - cur_prefx++; - } - if (text_pos != -1) - { - ME_SetCharFormat(editor, text_pos, (URLmax-text_pos), &link); - ME_RewrapRepaint(editor); - break; - } - } - } - return 0; -} - - static BOOL isurlspecial(WCHAR c) { static const WCHAR special_chars[] = {'.','/','%','@','*','|','\\','+','#',0}; diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 2c68378..84525ea 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -282,7 +282,6 @@ void ME_RTFParAttrHook(struct _RTF_Info *info); void ME_RTFTblAttrHook(struct _RTF_Info *info); void ME_RTFSpecialCharHook(struct _RTF_Info *info); void ME_StreamInFill(ME_InStream *stream); -int ME_AutoURLDetect(ME_TextEditor *editor, WCHAR curChar); extern int me_debug; extern void DoWrap(ME_TextEditor *editor); extern BOOL ME_FindNextURLCandidate(ME_TextEditor *editor, int sel_min, int sel_max,