File: //usr/lib/python3.5/idlelib/__pycache__/FormatParagraph.cpython-35.pyc
Füƒaw ã @ s² d Z d d l Z d d l m Z Gd d „ d ƒ Z d d „ Z d d „ Z d
d „ Z d d
„ Z d d „ Z d d „ Z
e d k r® d d l Z e j
d d d d d ƒd S)aÐ Extension 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 @ sI e Z d Z d d g f g Z d d „ Z d d „ Z d d d
„ Z d S)ÚFormatParagraphÚformatúFormat Paragraphú<<format-paragraph>>c C s
| | _ d S)N)Úeditwin)Úselfr © r ú-/usr/lib/python3.5/idlelib/FormatParagraph.pyÚ__init__ s zFormatParagraph.__init__c C s
d | _ d S)N)r )r r r r
Úclose s zFormatParagraph.closeNc C sP | d k r- t j d d d d d d d ƒ} | j j } | j j ƒ \ } } | r{ | r{ | j | | ƒ } t | ƒ } n$ t | | j d ƒ ƒ \ } } } } | rº t | | | ƒ } n t
| | ƒ } | j d
d d ƒ | | k r/| j d | ƒ | j
ƒ | j | | ƒ | j | | ƒ | j ƒ n | j d | ƒ | j d ƒ d
S)aÕ Formats 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Ú
extensionsr z max-widthÚtypeÚintÚdefaultéH ÚinsertZselz1.0ÚendÚbreak)r Z GetOptionr ÚtextZget_selection_indicesÚgetÚget_comment_headerÚfind_paragraphÚindexÚreformat_commentÚreformat_paragraphZ
tag_removeZmark_setZundo_block_startZdeleter Zundo_block_stopZsee) r ZeventÚlimitr ÚfirstÚlastÚdataÚcomment_headerÚnewdatar r r
Úformat_paragraph_event# s. $
z&FormatParagraph.format_paragraph_event)r r )Ú__name__Ú
__module__Ú__qualname__Zmenudefsr r r"