
    G@dz                        d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
mZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' d Z(d Z) G d de'          Z* G d de          Z+dS )zFind/Replace widget    N)QEventQSizeQtQTimerSignalSlot)QPixmapQTextCursor)	QActionQGridLayoutQHBoxLayoutQLabel	QLineEditQToolButtonQSizePolicyQSpacerItemQWidget)_)CONF)to_text_string)ima)regexp_error_msg)
TextHelper)create_toolbutton)get_eol_chars)PatternComboBoxc                     | |k    S )zReturn True is pos1 > pos2 pos1pos2s     :lib/python3.11/site-packages/spyder/widgets/findreplace.pyis_position_supr#   $       $;    c                     | |k     S )zReturn True is pos1 < pos2r   r   s     r"   is_position_infr'   (   r$   r%   c                   $     e Zd Z fdZd Z xZS )
SearchTextc                 \    d| _         t                                          |d           d S )Ni  Fadjust_to_minimum)recommended_widthsuper__init__)selfparent	__class__s     r"   r/   zSearchText.__init__/   s.    !$599999r%   c                 ,    t          | j        d          S )zRecommended size.
   )r   r-   r0   s    r"   sizeHintzSearchText.sizeHint3   s    T+R000r%   )__name__
__module____qualname__r/   r6   __classcell__r2   s   @r"   r)   r)   -   sG        : : : : :1 1 1 1 1 1 1r%   r)   c                   $    e Zd ZdZ ed           ed          dZ ee          Z e            Z	 e            Z
d)dZ fdZd Zd	 Zd
 Zd Zd*dZ fdZ e            d             Zd Zd Zd Zd Zd Zd*dZ e            d*d            Z e            d*d            Zd Zd Zd Z	 	 d+dZ  e            d)d            Z! e            d             Z" e            d)d            Z#d,d Z$d! Z%d" Z&d# Z'd$ Z(d-d&Z)d' Z*d( Z+ xZ,S ).FindReplacezFind widgetzRegular expression errorz
No matches)regexp_error
no_matchesFc           	          t          j         |           | _        d  _        d  _        t                      }|                    dddd                                |           t            j	        t          j        d                     _        |                     j        dd            j                                         _        t!                      _         j                             fd            j                             fd            j                                        j                             j                    j        j                             j                   t5                      _         j        j        j                             j                   d _        t          j        d	                                j                   _!        d
 _"        t          j        d           _#        t          j        d           _$        tK                      _&         j&        '                    d            j                                        (                     j&        tR          j*                    j                                        +                    tX                    d          _-        d _.        t            j/        t          j        d          ta          d                     _1         j        s j1        	                                 t            j2        t          j        d          ta          d                     _3        t            j4        t          j        d          ta          d                     _5         j5        j6                             j7                    j3        j6                             j7                   t           t          j        d          ta          d                     _8         j8        9                    d            j8        j:                             fd           t           t          j        d          ta          d                     _;         j;        9                    d            j;        j:                             fd           t           t          j        d          ta          d                     _<         j<        9                    d            j<        j:                             fd             j         j         j3         j5         j8         j;         j<         j1         j        g	 _=        t}                      } j=        dd!         D ]}|                    |           |?                    t          d"d                     |                     j                   |?                    t          ddt          jB        #                     |C                    |dd           t           d$           _E         jE        jF                             fd%            jE                                        G                    ta          d&                     t           ta          d'          t          j        d(           jH        )           _I        t           ta          d*          t          j        d+           jJ        )           _K         jK        j6                             jL                    jK        j6                             j7                   t           ta          d,          t          j        d-           jM        )           _N         jN        j6                             jL                    jN        j6                             j7                   t}                      } jE         jI         jK         jN        g}|D ]}|                    |           |O                    d           |C                    |dd            j=        P                    |           | _Q         R                                  j        S                     j         jE                    T                    t          jB        t          jU                    V                    |           _W        t                      _Y         jY        Z                    d            jY        [                    d.            jY        j\                             j]                    j        ^                                t                      __         j_        Z                    d            j_        [                    d/            j_        j\                             j`                   d S )0N      DialogCloseButton)	triggerediconr   c                  6                          dddd          S )NFchangedforwardrehighlightmultiline_replace_checkfindr5   s   r"   <lambda>z&FindReplace.__init__.<locals>.<lambda>[   s'    IIeU05  7 7 r%   c                  6                          dddd          S )NFTrG   rL   r5   s   r"   rN   z&FindReplace.__init__.<locals>.<lambda>a   s'    IIeTu05  7 7 r%   Fnumber_matches r?   error   replaceReplace text)toggledrE   tipfindpreviousFind previous)rD   rE   rW   findnext	Find nextregexzUse regular expressions)rE   rW   Tc                 ,                                     S NrL   stater0   s    r"   rN   z&FindReplace.__init__.<locals>.<lambda>   s    TYY[[ r%   format_letter_casezEnable case sensitive searchesc                 ,                                     S r^   rL   r_   s    r"   rN   z&FindReplace.__init__.<locals>.<lambda>   s    tyy{{ r%   format_letter_matcheszOnly search for whole wordsc                 ,                                     S r^   rL   r_   s    r"   rN   z&FindReplace.__init__.<locals>.<lambda>   s    		 r%   r4   )hPolicyr+   c                 0                         d          S )NT)focus_replace_text)replace_find)r   r0   s    r"   rN   z&FindReplace.__init__.<locals>.<lambda>   s    d''4'@@ r%   ReplacezReplace next occurrencereplace_next)rW   rE   rD   z Replace occurrences in selectionreplace_selectionzReplace all occurrencesreplace_alli,     )ar   r/   enable_replaceeditoris_code_editorr   setContentsMargins	setLayoutr   hider   rE   close_button	addWidgeticonSize	icon_sizer)   search_textreturn_shift_pressedconnectreturn_pressedlineEdit
textEditedtext_has_been_editedsig_resized_resize_replace_textr   number_matches_textclear_actionrD   clear_matcheshide_number_matches_textpixmapnumber_matches_pixmapmatches_stringno_matches_icon
error_iconr   messages_action
setVisible	addActionr   TrailingPositionfindChildrenr   messages_button
replace_onchange_replace_stater   replace_text_buttonfind_previousprevious_button	find_nextnext_buttonclickedupdate_search_combo	re_buttonsetCheckablerV   case_buttonwords_buttonwidgetsr   addSpacerItemr   r   	Expanding	addLayoutr   replace_textvalidsetPlaceholderTextri   replace_buttonreplace_find_selectionreplace_sel_buttonupdate_replace_comboreplace_find_allreplace_all_button
addStretchextendreplace_widgetshide_replacesetTabOrdersetSizePolicyFixedcreate_shortcuts	shortcutsr   highlight_timersetSingleShotsetIntervaltimeouthighlight_matchesinstallEventFiltershow_matches_timershow_matches)r0   r1   ro   glayoutsearch_layoutwidgetreplace_layoutr   s   `       r"   r/   zFindReplace.__init__C   sX	   v&&&,"--""1aA...w-i-..
 
 

 	$+Q222 *3355 &d++!))7 7 7 7	
 	
 	
 	##7 7 7 7	
 	
 	
 	!!##.66%	' 	' 	'$,,T-FGGG#)$<< %/778JKKK(-%H%&&--dn== 	" !"x55(7++&t}}''...!!##-- )"<	> 	> 	>
 %%''44[AA!D 	  #4-)$$.!!	$
 $
 $
  " 	,$))+++0(.))/""	 
  
  
 -n*%%+	
 
 
 	 (()ABBB$,,T-EFFF*sx((+,,
 
 
 	##D)))&&'@'@'@'@AAA,.//233
 
 

 	%%d+++ (()B)B)B)BCCC-122/00
 
 

 	&&t,,,!))*C*C*C*CDDD  N$$

 $l1R4( 	, 	,F##F++++##KA$6$6777 8999##1k&;<<<	
 	
 	
 	-A... ,#
 
 
 	''@@@@	B 	B 	B""$$77)EEE/+,,.))'	
 
 
 #4455-..1	#
 #
 #
 	'//0IJJJ'//0HIII"3+,,-((+	#
 #
 #
 	'//0IJJJ'//0HIII$##	
  	- 	-F$$V,,,,!!!$$$.!Q///G$$$& 	$$T%5t7HIII;0+2CDDD..v66  &d||**4000((---$,,T-CDDD 	++D111 #),,--d333++B///'//0ABBBBBr%   c                    t          |t                    sdS |                                t          j        k    r|                                }|                                t          j        z  }|t          j        k    r5|r| j	        
                                 n| j        
                                 |t          j        k    r^| j                                        r1| j                            | j                                                   |                                  |                                t          j        k    r^| j                            | j                                                                        dz
  | j                                                   t3                                          ||          S )af  
        Event filter for search_text widget.

        Notes
        -----
        * Emit signals when Enter and Shift+Enter are pressed. These signals
          are used for search forward and backward.
        * Add crude hack to get tab working between the find/replace boxes.
        * Reduce space between the messages_button and the clear one.
        T*   )
isinstancer   typeKeyPresskey	modifiersr   ShiftModifier
Key_Returnrz   emitr|   Key_Tabry   hasFocusr   set_current_textcurrentTextfocusNextChildPaintr   mover}   widthyr.   eventFilter)r0   r   eventr   shiftr2   s        r"   r   zFindReplace.eventFilter  s{    %(( 	4::<<6?**))++COO%%(88Ebm## /-224444',,...bj  #,,.. 8%66(44668 8 8##%%%::<<6<'' %% ))++1133b8$&&((  
 ww""65111r%   c                 2   t          j        | j        dd|          }t          j        | j        dd|          }t          j        | j        dd|          }t          j        | j        dd|          }t          j        | j        dd|           }|||||gS )z Create shortcuts for this widgetfind_replacer[   )contextnamer1   rY   z	Find textrU   zhide find and replace)r   config_shortcutr   r   showshow_replacert   )r0   r1   rZ   findprev
togglefindtogglereplacert   s          r"   r   zFindReplace.create_shortcuts6  s     'N"	   '" 	   )I"	  
 ,"	   #I"(	   (JtDDr%   c                 $    d | j         D             S )z
        Returns shortcut data, a list of tuples (shortcut, text, default)
        shortcut (QShortcut or QAction instance)
        text (string): action/shortcut description
        default (string): default key sequence
        c                     g | ]	}|j         
S r   )data).0scs     r"   
<listcomp>z1FindReplace.get_shortcut_data.<locals>.<listcomp>`  s    111B111r%   )r   r5   s    r"   get_shortcut_datazFindReplace.get_shortcut_dataY  s     21$.1111r%   c                 f    | j                                         j                                         d S r^   )ry   r}   returnPressedr   r5   s    r"   r   zFindReplace.update_search_combob  s,    !!##16688888r%   c                 f    | j                                         j                                         d S r^   )r   r}   r   r   r5   s    r"   r   z FindReplace.update_replace_comboe  s,    ""$$27799999r%   Tc                 @   t          j        |            |                                  | j                            d           |                                  | j        |r4| j        d                                         r| 	                                 n| j
                            d           | j                                        }|s&t          |                                          dk    rd}|smd}	 | j                                        }|                    t"          j                   t'          |                                          }n# t*          $ r Y nw xY w|r| j                                        r|rZ| j                            |           | j                                                                         |                                  n+| j                                                                         | j                                         dS dS )Overrides Qt MethodTNr   rS   F)r   r   _width_adjustmentsvisibility_changedr   change_number_matchesrp   r   	isVisibler   r   
setCheckedget_selected_textlen
splitlines
textCursorselectr
   WordUnderCursorr   selectedTextAttributeErrorry   r   setEditTextr}   	selectAllrefreshsetFocus)r0   r   texthighlightedcursors        r"   r   zFindReplace.showh  s
   T!!!$$T***""$$$;" :'*4466 (%%'''(33D999 ;0022D <s4??#4#455::"  "'K!%!7!7!9!9k&ABBB-f.A.A.C.CDD)   
  < 0 < < > > <+ <$00666$--//99;;;LLNNNN$--//99;;;%%'''''? #"s   7AE 
EEc                 r    t                                          |           |                                  d S r^   )r.   resizeEventr   )r0   r   r2   s     r"   r  zFindReplace.resizeEvent  s3    E"""!!!!!r%   c                 ^    |r|                                   dS |                                  dS )zShow and hide replace widgetN)r   r   )r0   r   s     r"   replace_widgetzFindReplace.replace_widget  s<      	 r%   c                     | j          | _         | j                            | j                    |                     | j                    dS )z.Handle the change of the replace state widget.N)r   r   r   r  r5   s    r"   r   z FindReplace.change_replace_state  sC    "o- ++DO<<<DO,,,,,r%   c                 >   | j         D ]}|                                 t          j        |            | j                            d           | j                            d           | j        /| j                                         | 	                                 dS dS )r   FN)
r   rt   r   r   r   r   r   rp   r   r   r0   r   s     r"   rt   zFindReplace.hide  s    * 	 	FKKMMMMT ++E222$$U+++;"K  """      #"r%   c                     | j         r4|                     d           | j        D ]}|                                 dS dS )zShow replace widgetsF)r   N)ro   r   r   r  s     r"   r   zFindReplace.show_replace  sV     	II5I))).  	 	 r%   c                 v    | j         D ]0}|                                 | j                            d           1dS )zHide replace widgetsFN)r   rt   r   r   r  s     r"   r   zFindReplace.hide_replace  sE    * 	7 	7FKKMMM$//6666	7 	7r%   c                     |                                  r| j        |                                  dS | j        du}| j        D ]}|                    |           |r|                                  dS dS )zRefresh widgetN)isHiddenrp   r   r   
setEnabledrM   )r0   r`   r   s      r"   r   zFindReplace.refresh  s    ==?? 	{&""$$$F4'l 	% 	%Fe$$$$ 	IIKKKKK	 	r%   c                 ~   	 ddl m} n# t          $ r t          d          }Y nw xY wddlm} | j                            t          ||                      | j	                            t          ||                      t          ||          | _
        | j        +| j
        r$| j        j                            | j                   || _        | j
        r$| j        j                            | j                   |r|                                  |                                 r||                                  dS dS dS )zSet associated editor.r   )QWebEngineViewN)
CodeEditor)qtpy.QtWebEngineWidgetsr  ImportErrorr   (spyder.plugins.editor.widgets.codeeditorr  r   r   r   r   rq   rp   textChanged
disconnectupdate_matchesr{   r   r
  r   )r0   rp   r   r  r  s        r"   
set_editorzFindReplace.set_editor  sd   	(>>>>>>> 	( 	( 	(!$ZZNNN	(GGGGGG$$FN)K)K%KLLL!!j&H&H"HIII(<< ;"t':"K#..t/BCCC   	AK#++D,?@@@ 	LLNNN==?? 	!v1     	! 	!11s   	 %%c                     |                      dddd          }|r| j                                         | j                                         |S )zFind next occurrenceFTrG   )rM   rp   r   ry   add_current_textr0   	set_focusr`   s      r"   r   zFindReplace.find_next  s[     		%527  9 9 	#K  """))+++r%   c                 n    |                      dddd          }|r| j                                         |S )zFind previous occurrenceFrG   )rM   rp   r   r  s      r"   r   zFindReplace.find_previous  sF     		%E27  9 9 	#K  """r%   c                 6    |                      ddd           dS )z
        Find text has been edited (this slot won't be triggered when setting
        the search pattern combo box text programmatically).
        T)rH   rI   start_highlight_timerNrL   )r0   r   s     r"   r   z FindReplace.text_has_been_edited  s"    
 			$D	IIIIIr%   c                    | j         r| j                                        }| j                                        }| j                                        }| j                                        }| j                            ||||           dS dS )zHighlight found results)wordregexpcaseN)	rq   ry   r   r   	isCheckedr   r   rp   highlight_found_results)r0   r   r   r  r  s        r"   r   zFindReplace.highlight_matches  s     	;#//11D#--//D$..00D^--//FK//4T 0 ; ; ; ; ;	; 	;r%   c                     d| _         | j                            d           | j                                         | j        r| j                                         dS dS )zClear all highlighted matchesrQ   FN)r   r   r   r   rt   rq   rp   clear_found_resultsr5   s    r"   r   zFindReplace.clear_matches	  se     ''... %%''' 	.K++-----	. 	.r%   c                 `   |rl| j         d                                         rM| j                                        }t	          t          |                                                    dk    rdS | j                                        }t	          |          dk    rK| j	        s| j        
                    d           |                                  |                                  dS | j                                        }| j                                        }	| j                                        }
| j        
                    |||||	|
          }d}|s(|
r&t#          |          }|r|                     |           |rdS | j	        r|rt'          | j                                                  }t+          | j                                      |           |s| j        j        sI| j                                         |r| j                                         n)|                                  n|                                  | j                            |||
|	          }t;          | j        d          r| j                            |||
|	          }nd}|                     ||	           |S )
zCall the find functionr   rS   NrQ   )r   r  r  Fr   r  r  get_match_number)current_matchtotal_matches)r   r   rp   r   r   r   r   ry   r   rq   	find_textr   r   r   r!  r   r   r   
show_errorr
   r   r   unfold_if_colapsedfound_resultsr   stopstartr   get_number_matcheshasattrr'  )r0   rH   rI   rJ   r  rK   sel_textr   r   r  r  found	error_msgr   rP   match_numbers                   r"   rM   zFindReplace.find  s    # 	t';A'>'H'H'J'J 	{4466H>(++668899A==t++--t99>>& *%%b)))&&(((   4#--//D$..00D^--//FK))$t/3F * D DE I /V /,T22	 /OOI...  " %u %$T[%;%;%=%=>>4;''::6BBB 1dk&? 1(--///, 1,224444..000""$$$![;;DtCIAE < G GN t{$677 !#{;;DtCIAE  <  G  G  !&&\5C ' E E ELr%   c                    | j         dS t          | j                                                  }t          | j                                                  }d}| j                                        }|rt          j        nt          j	        t          j        z  }| j
                                        rD	 t          j        ||          }|                    |d           n# t          j        $ r Y dS w xY wt          | j                                                   }|r|n|                                }|r|n|                                }	d}
|<| j                                         }|r||	k    r|                     ddd          sd}
n@t%          |                    |	                    dk    r|                     ddd          sd}
d}|
r| j                                         }|                                 |*|                                 |                    |           nt          |                                          }t3          | j                                                   }|                    d|          }|                                 |                    |                    ||                     |                     d	          r}| j                                         }|                    |                                t>          j                    |                    |!                                t>          j"                   ||#                                 |r| j        $                                 n| j         $                                 tK          | j         d
d          r| j         &                                 dS dS )zReplace and find.NflagsrQ   TF)rH   rI   rJ   r   u    )r  document_did_change)'rp   r   r   r   ry   r   r!  re	MULTILINE
IGNORECASEr   compilesubrR   r   lowerhas_selected_textrM   r   findallr   beginEditBlockremoveSelectedText
insertTextr   r   toPlainTextrT   r   setPositionselectionStartr
   
MoveAnchorselectionEnd
KeepAnchorendEditBlockr   getattrr9  )r0   rh   r   ry   
re_patternr   re_flagsseltxtcmptxt1cmptxt2
do_replacehas_selectedr   eol_charfound_cursors                  r"   ri   zFindReplace.replace_findO  s    ;F%d&7&C&C&E&EFF$T%5%A%A%C%CDD
))++#'I2<<R]R\-I >##%% 	Z8DDD
 |R00008   
   = = ? ?@@!%>++;+<+<+>+> 4&&fllnn
;88::L '7g#5#5yy-2 ! 4 4 '!&J:%%g..//144yy-2 ! 4 4 '!&J 	;[++--F!!###!))+++!!,////'(;(;(=(=>> ))@)@)B)BCC	8<<))+++!!*..v"F"FGGG~~~.. ;#{5577""<#>#>#@#@#.#9; ; ;""<#<#<#>#>#.#9; ; ; !!! 	#&&((((K  """4; 5u== 	.K++-----	. 	.s   2,C C21C2c                    | j         dS t          | j                                                  }t          | j                                                  }d}| j                                        }|rt          j        nt          j	        t          j        z  }| j
                                        }|rD	 t          j        ||          }|                    |d           n># t          j        $ r Y dS w xY wt          j        t          j        |          |          }| j                             dd          }| j                                         }|                                 |                                 |                    |                    ||                     |                                 | j                                          dS )z)Replace and find all matching occurrencesNr7  rQ   sofeof)rp   r   r   r   ry   r   r!  r:  r;  r<  r   r=  r>  rR   escape_select_textrE  rB  rC  rD  rK  r   )	r0   r   ry   rM  r   rN  
re_enabledr   r   s	            r"   r   zFindReplace.replace_find_all  s    ;F%d&7&C&C&E&EFF$T%5%A%A%C%CDD
))++#'I2<<R]R\-I^--//
 
	LZ8DDD
 |R00008    BIk$:$:(KKKJ))%77{&&((!!###*..t<<===s   4,C! !C43C4c                    | j         t          | j                                                  }t          | j                                                  }| j                                        }| j                                        }|rt          j	        nt          j
        t          j	        z  }d}| j                                        r|}n*t          j        |          }|                    dd          }|rd                    |          }	 t          j        ||          }|                    |d           n# t          j        $ r Y dS w xY wt          | j                                                   }	|                    ||	          }
|
|	k    r| j                                         }|                                }|                                 |                                 |                    |
           | j                             |           t3          t5          |
                    D ]}| j                             dd	           |                                 |r| j                                         n| j                                          t=          | j         d
d          r| j                                          dS dS dS )z)Replace and find in the current selectionN\z\\z\b{pattern}\b)patternr7  rQ   	characterrightr9  F) rp   r   r   r   ry   r   r!  r   r:  r;  r<  r   rY  rT   formatr=  r>  rR   r   r   rG  rB  rC  rD  set_cursor_positionranger   extend_selection_to_nextrK  r   rL  r9  )r0   rh   r   ry   r   r  rN  rM  r^  selected_textreplacementr   	start_poscs                 r"   r   z"FindReplace.replace_find_selection  s    ;")$*;*G*G*I*IJJL()9)E)E)G)GHHK#--//D$..00D'+Mr||1MHJ~'')) A%)K00+33D%@@ C*11'1BBZx@@@
 |R00008    +4;+H+H+J+JKKM$..}EEKm++//11"1133	%%'''))+++!!+...//	:::s;//00 O OAK88gNNNN##%%%! '!**,,,,$$&&&t{$95AA 2//11111] #"Z2 2s   ,D< <EEr   c                    |rA|r?d                     |t          d          |          | _        |                                  dS |r>d                     |t          d                    | _        |                                  dS | j                                         | j                                        r|                                  dS dS )z)Change number of match and total matches.z{} {} {}ofz{} {}matchesN)	ra  r   r   r   r   rt   ry   r   show_no_matches)r0   r(  r)  s      r"   r   z!FindReplace.change_number_matches  s     
	'] 
	'","3"3M1T774A#C #CD 	'")..)"M"MD$))+++++-- '$$&&&&&' 'r%   c                 v   |                                  r| j                            | j                                                                        | j                                        | j                                        | j	                                                  }| 
                    |           dS dS )zAUpdate total number of matches if text has changed in the editor.r&  )r)  N)r   rp   r0  ry   r}   r   r   r!  r   r   r   )r0   rP   s     r"   r  zFindReplace.update_matches  s    >> 	E![;; ))++0022%//11~//11&0022	 <  N &&^&DDDDD	E 	Er%   c                 0    |                      d           dS )z'Show a no matches message with an icon.r?   N_show_icon_messager5   s    r"   rl  zFindReplace.show_no_matches
  s    -----r%   c                    | j         sdS | j                                         | j                            d           | j        r@| j                            | j                   | j                            | j                    dS | j                            t                                 | j        
                    | j                    dS )z1Show the number of matches found in the document.NF)r   r   r   r   r   r   	setPixmapr   
setToolTipr	   setTextr5   s    r"   r   zFindReplace.show_matches  s    " 	F %%'''''...( 	B$..t/IJJJ$//0CDDDDD$..wyy999$,,T-@AAAAAr%   c                 4    |                      d|           dS )z)Show a regexp error message with an icon.rR   )
extra_infoNro  )r0   r4  s     r"   r+  zFindReplace.show_error  s!    I>>>>>r%   Nc                    |dk    r| j         d         }| j        }n| j         d         }| j        }|r|dz   |z   }| j                            |           | j                            |           | j                            d           dS )aK  
        Show a message to users with an icon when no matches can be found or
        there's an error in the passed regexp.

        Parameters
        ----------
        kind: str
            The kind of message. It can be 'no_matches' or 'error'.
        extra_info:
            Extra info to add to the icon's tooltip.
        r?   r>   z: TN)TOOLTIPr   r   r   setIconrs  r   )r0   kindrv  tooltiprE   s        r"   rp  zFindReplace._show_icon_message!  s     <l<0G'DDl>2G?D 	2nz1G$$T***''000''-----r%   c                    | j                                         t          | j                  dz
  z  }|                                                                 }| j                                                                        }| j        j        |z   |z   }||k     r"| j                            d           d| _	        n1| j                            t          |dz                       d| _	        | j                                         dS )z:Several adjustments according to the widget's total width.      TFN)rx   r   r   r   sizer   ry   r-   setMinimumWidthr   intr   r/  )r0   buttons_widthtotal_widthmatches_widthminimal_widths        r"   r   zFindReplace._width_adjustments;  s     ,,..#dl2C2Ca2GHiikk''))05577==??.>N 	 &&,,R000,0D)),,Sq-A-ABBB,1D)
 	%%'''''r%   c                     | j                             |                                           | j                             |                                           dS )zT
        Resize replace_text combobox to match the width of the search one.
        N)r   r  r   setMaximumWidth)r0   r  old_sizes      r"   r   z FindReplace._resize_replace_textS  sH     	))$**,,777))$**,,77777r%   )F)T)TTTFT)r   r   r^   )-r7   r8   r9   __doc__r   rx  r   boolr   rz   r|   r/   r   r   r   r   r   r   r  r   r  r   rt   r   r   r   r  r   r   r   r   r   rM   ri   r   r   r   r  rl  r   r+  rp  r   r   r:   r;   s   @r"   r=   r=   8   s,       455aoo G
  !688VXXNHC HC HC HCT'2 '2 '2 '2 '2R!E !E !EF2 2 29 9 9: : :'( '( '( '(R" " " " " 
TVV    V - - -	! 	! 	!  7 7 7
 
 
! ! ! !< 
TVV   V 
TVV   VJ J J; ; ;. . . <@BF< < < <| 
TVVK. K. K. VK.Z 
TVV  V@ 
TVV02 02 02 V02d' ' ' '	E 	E 	E. . .B B B? ? ?. . . .4( ( (08 8 8 8 8 8 8r%   r=   ),r  r:  qtpy.QtCorer   r   r   r   r   r   
qtpy.QtGuir	   r
   qtpy.QtWidgetsr   r   r   r   r   r   r   r   r   spyder.config.baser   spyder.config.managerr   spyder.py3compatr   spyder.utils.icon_managerr   spyder.utils.miscr   "spyder.plugins.editor.utils.editorr   spyder.utils.qthelpersr   spyder.utils.sourcecoder   spyder.widgets.comboboxesr   r#   r'   r)   r=   r   r%   r"   <module>r     s     
			 @ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + + + + + + + +% % % % % % % % % % % % % % % % % % % % % %
 !           & & & & & & + + + + + + ) ) ) ) ) ) . . . . . . 9 9 9 9 9 9 4 4 4 4 4 4 1 1 1 1 1 1 5 5 5 5 5 5    
1 1 1 1 1 1 1 1`8 `8 `8 `8 `8' `8 `8 `8 `8 `8r%   