Your IP : 3.12.163.23
��Yfw � @ 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 �</opt/alt/python35/lib64/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"