JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbrў fc@sdZddlZddlmZGdddZddZdd Zd d Zd d ZddZ ddZ e dkrddl m Z dge _ddlZejdddddndS(uExtension 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 :-) iN(uidleConfcBsJ|EeZdZdd gfgZddZddZdd Zd S( uFormatParagraphuformatuFormat Paragraphu<>cCs ||_dS(N(ueditwin(uselfueditwin((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu__init__suFormatParagraph.__init__cCs d|_dS(N(uNoneueditwin(uself((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuclose suFormatParagraph.closec Cs>tjddddd}|jj}|jj\}}|ri|ri|j||}t|}n$t||jd\}}}}|rt |||}nt ||}|j ddd ||kr|j d||j |j|||j|||jn|j d||jdd S( uFormats 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. umainuFormatParagraphu paragraphutypeuintuinsertuselu1.0uendubreak(uidleConfu GetOptionueditwinutextuget_selection_indicesugetuget_comment_headerufind_paragraphuindexureformat_commentureformat_paragraphu tag_removeumark_setuundo_block_startudeleteuinsertuundo_block_stopusee( uselfueventumaxformatwidthutextufirstulastudataucomment_headerunewdata((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuformat_paragraph_event#s*   $    u&FormatParagraph.format_paragraph_eventN(uFormat Paragraphu<>(u__name__u __module__u __qualname__umenudefsu__init__ucloseuformat_paragraph_event(u __locals__((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuFormatParagraphs   uFormatParagraphc 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( uReturns 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. u.u%d.0u%d.endusu#reformat_comment..iuiNc3s|]}|VqdS(N((u.0uline(ucomment_header(u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu sii(ulenujoinusplitumaxureformat_paragraph(udataulimitucomment_headeru format_widthunewdatau block_suffix((ucomment_headerulcu</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyureformat_comments + ureformat_commentcCstjd|dk S(u/Return True if line is empty or all whitespace.u^\s*$N(ureumatchuNone(uline((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu is_all_whitesu is_all_whitecCstjd|jS(u/Return the initial space or tab indent of line.u ^([ \t]*)(ureumatchugroup(uline((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyu get_indentsu get_indentcCs/tjd|}|dkr"dS|jdS(uReturn 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. u ^([ \t]*#*)uiN(ureumatchuNoneugroup(ulineum((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyuget_comment_headers uget_comment_headeru__main__(usupportuguiu&idlelib.idle_test.test_formatparagraphu verbosityiuexitF(u__doc__ureuidlelib.configHandleruidleConfuFormatParagraphufind_paragraphureformat_paragraphureformat_commentu is_all_whiteu get_indentuget_comment_headeru__name__utestusupportu use_resourcesuunittestumainuFalse(((u</opt/alt/python33/lib64/python3.3/idlelib/FormatParagraph.pyus 3 % $