Ë ½.ÁÀ’¿Æãóª—dZddlZeje_ddlmZmZmZddlmZd„Z Gd„d«Z d„Z d „Z d „Z ed k(rdd lmZed d¬«yy)z'Define SearchEngine for search dialogs.éN)Ú StringVarÚ BooleanVarÚTclError)Ú messageboxcóR—t|d«st|«|_|jS)z¼Return the singleton SearchEngine instance for the process. The single SearchEngine saves settings between dialog instances. If there is not a SearchEngine already, make one. Ú _searchengine)ÚhasattrÚ SearchEnginer)Úroots ú+/usr/lib/python3.12/idlelib/searchengine.pyÚgetr s'€ô �4˜Ô )Ü)¨$Ó/ˆÔà × Ñ Ðócór—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zdd„Zdd„Zdd„Zdd„Zy )r zØØ×ÑÓ!ˆØˆØ�{‰{Œ}ØœBŸM™MÑ)ˆEð Ü—:‘:˜c 5Ó)ˆDðˆ øô�‰ò Ø × Ñ ˜c 1§5¡5¨!¯%©%Ô 0Üûð úsÁA4Á4B8Â'B3Â3B8Ncó°—dt|«z}|r|dzt|«z}|�|dzt|«z}tjd||j¬«y)NzError: z Pattern: z Offset: zRegular expression error)Úmaster)ÚstrrÚ showerrorr )rr!r9Úcols r r5zSearchEngine.report_error]sX€àœ#˜c›(Ñ"ˆÙ ؘ Ñ%¬¨C«Ñ0ˆCØ ˆ?ؘ Ñ$¤s¨3£xÑ/ˆCÜ×ÑÐ7Ø"¨4¯9©9ö 6rcóP—|s|j«}|sy|jj«}t|«\}}|j «r-|r|}n|}t |«\}} |j |||| ||«} | S|r|}n|}t |«\}} |j|||| ||«} | S)a¶Return (lineno, matchobj) or None for forward/backward search. This function calls the right function with the right arguments. It directly return the result of that call. Text is a text widget. Prog is a precompiled pattern. The ok parameter is a bit complicated as it has two effects. If there is a selection, the search begin at either end, depending on the direction setting and ok, with ok meaning that the search starts with the selection. Otherwise, search begins at the insert mark. To aid progress, the search functions do not return an empty match at the starting position unless ok is True. N)r>rr Ú get_selectionr-Ú get_line_colÚsearch_backwardÚsearch_forward) rÚtextr<ÚokÚwrapÚfirstÚlastÚstartÚlinerCÚress r Ú search_textzSearchEngine.search_textgs¹€ñ$Ø—<‘<“>ˆDÙØØ�|‰|×ÑÓ!ˆÜ# DÓ)‰ ˆˆtØ �;‰;Œ=ÙØ‘à�Ü$ UÓ+‰IˆD�#Ø×&Ñ& t¨T°4¸¸dÀBÓGˆCðˆ ñ Ø‘à�Ü$ UÓ+‰IˆD�#Ø×%Ñ% d¨D°$¸¸TÀ2ÓFˆC؈ rcó>—d}|}|jd|zd|dzz«} | r||j| dd|«} | r|s| j«|kDr|| fS|dz}|r||kDr yd}d}|jd|zd|dzz«} | s|rd}d}d}|jdd«} | rŒ|y)Nrú%d.0ééÿÿÿÿz1.0z2.0)r ÚsearchÚend) rrIr<rOrCrKrJÚwrappedÚ startlineÚcharsÚms r rHzSearchEngine.search_forward�sπ؈؈ Ø—‘˜ $™¨°$°q±&Ñ(9Ó:ˆÙØ— ‘ ˜E # 2˜J¨Ó,ˆAÙÙ˜Ÿ™› 3šØ ˜7�Nؘ!‘8ˆDÙ˜4 )Ò+ØððˆC؈BØ—H‘H˜V d™]¨F°d¸1±fÑ,=Ó>ˆEÙ™TØ�Ø�Ø�ØŸ™ ¨Ó.�òð rcóŒ—d}|}|jd|zd|dzz«} t|| dd|«} | r|s| j«|kr|| fS|dz }|r||kr yd}|dkr;|s yd}d}|jd«} t t | j d««\}}|jd|zd|dzz«} t| «dz }Œ¥)NrrSrTrUzend-1cÚ.)r Úsearch_reverserNÚindexÚmapÚintÚsplitÚlen) rrIr<rOrCrKrJrXrYrZr[r:s r rGzSearchEngine.search_backward¥sð€ØˆØˆ Ø—‘˜ $™¨°$°q±&Ñ(9Ó:ˆØÜ˜t U¨3¨B Z°Ó5ˆAÙÙ˜Ÿ™› SšØ ˜7�Nؘ!‘8ˆDÙ˜4 )Ò+ØððˆBØ�qŠyÙØðð �Ø�Ø—j‘j Ó*�ܤ S§Y¡Y¨s£^Ó4‘ ��cØ—H‘H˜V d™]¨F°d¸1±fÑ,=Ó>ˆEÜ�e“*˜q‘.ˆCð#rr)Nr)r)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr"r$r&r)r+r-r1r3r>r5rQrHrG©rr r r sQ„ÙFò /ò!òò ò"ò"ò"ò"ò òòó"6ó&óPô,rr cóî—|j|«}|syd}|j«\}}||krF||krA|}||k(r|dz}|j||«}|s |S|j«\}}||kr||krŒA|S)a&Search backwards and return an re match object or None. This is done by searching forwards until there is no match. Prog: compiled re object with a search method returning a match. Chars: line of text, without \n. Col: stop index for the search; the limit for match.end(). NrT)rVÚspan)r<rZrCr[ÚfoundÚiÚjs r r^r^¾s�€ð � ‰ �EÓ€AÙ ØØ €EØ �6‰6‹8�D€A€qØ ˆcŠ'�a˜3’hØˆØ �Š6Ø�!‘ˆAØ �K‰K˜˜qÓ !ˆÙØ à €Lð�v‰v‹x‰ˆˆ1ð ˆcŠ'�a˜3“hð €Lrcó¤— |jd«}|jd«}|s|jd«}|s|}||fS#t$rdx}}YŒ*wxYw)zFReturn tuple of 'line.col' indexes from selection or insert mark. z sel.firstzsel.lastNÚinsert)r_r)rIrLrMs r rErEÕsc€ðØ— ‘ ˜;Ó'ˆØ�z‰z˜*Ó%ˆñ Ø— ‘ ˜8Ó$ˆÙ ØˆØ �$ˆ;Ðøô òØÐˆ’ðús‚"?¿ AÁAcóN—tt|jd««\}}||fS)z8Return (line, col) tuple of ints from 'line.col' string.r])r`rarb)r_rOrCs r rFrFãs%€ä”C˜Ÿ™ SÓ)Ó*�I€Dˆ#Ø �ˆ9ÐrÚ__main__)Úmainz#idlelib.idle_test.test_searchengineé)Ú verbosity)rgr/Úerrorr8Útkinterrrrrr r r^rErFrdÚunittestrrrhrr Úrxs]ðÙ-Û Ø—(‘(€„ç3Ñ3Ýò ÷gñgòTò. òð  ˆzÒÝÙÐ .¸!Ö<ðr