PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  pYw@sdZddlZddlmZGdddZddZdd Zd d Zd d ZddZ ddZ e dkrddl Z e j ddddddS)aExtension to format a paragraph or selection to a max width. Does basic, standard text formatting, and also understands Python comment blocks. Thus, for editing Python source code, this extension is really only suitable for reformatting these comment blocks or triple-quoted strings. Known problems with comment reformatting: * If there is a selection marked, and the first line of the selection is not complete, the block will probably not be detected as comments, and will have the normal "text formatting" rules applied. * If a comment block has leading whitespace that mixes tabs and spaces, they will not be considered part of the same block. * Fancy comments, like this bulleted list, aren't handled :-) N)idleConfc@sIeZdZdd gfgZddZddZdd d ZdS) FormatParagraphformatFormat Paragraph<>cCs ||_dS)N)editwin)selfrr ./opt/python35/lib/python3.5/FormatParagraph.py__init__szFormatParagraph.__init__cCs d|_dS)N)r)rr r r close szFormatParagraph.closeNc CsP|dkr-tjddddddd}|jj}|jj\}}|r{|r{|j||}t|}n$t||jd \}}}}|rt |||}nt ||}|j d d d ||kr/|j d ||j |j|||j|||jn|j d ||jd d S)aFormats paragraph to a max width specified in idleConf. If text is selected, format_paragraph_event will start breaking lines at the max width, starting from the beginning selection. If no text is selected, format_paragraph_event uses the current cursor location to determine the paragraph (lines of text surrounded by blank lines) and formats it. The length limit parameter is for testing with a known value. N extensionsrz max-widthtypeintdefaultHinsertZselz1.0endbreak)rZ GetOptionrtextZget_selection_indicesgetget_comment_headerfind_paragraphindexreformat_commentreformat_paragraphZ tag_removeZmark_setZundo_block_startdeleterZundo_block_stopZsee) reventlimitrfirstlastdatacomment_headernewdatar r r format_paragraph_event#s.    $    z&FormatParagraph.format_paragraph_event)rr)__name__ __module__ __qualname__Zmenudefsr r r$r r r r rs   rc Cstt|jd\}}|jd|d|}xM|jd|ddrt|r|d}|jd|d|}q;W|}t|}t|}xQt||krt||d r|d}|jd|d|}qWd|}|d}|jd|d|}x]|dkrt||krt||d r|d}|jd|d|}q+Wd|d} | |||j| |fS) zReturns the start/stop indices enclosing the paragraph that mark is in. Also returns the comment format string, if any, and paragraph of text between the start/stop indices. .z%d.0z%d.endsz#reformat_comment..r*Nc3s|]}|VqdS)Nr )rDr2)r"r r rFsrI)r.r=r,maxr)r!rr"Z format_widthr#Z block_suffixr )r"rEr rs + rcCstjd|dk S)z/Return True if line is empty or all whitespace.z^\s*$N)r7match)r2r r r r-sr-cCstjd|jS)z/Return the initial space or tab indent of line.z ^([ \t]*))r7rKgroup)r2r r r r6sr6cCs/tjd|}|dkr"dS|jdS)aReturn string with leading whitespace and '#' from line or ''. A null return indicates that the line is not a comment line. A non- null return, such as ' #', will be used to find the other lines of a comment block with the same indent. z ^([ \t]*#*)NrHr*)r7rKrL)r2mr r r rs r__main__z&idlelib.idle_test.test_formatparagraph verbosityr4exitF)__doc__r7Zidlelib.configHandlerrrrrrr-r6rr%Zunittestmainr r r r s 8 % $