Your IP : 3.148.115.187
3
��2a� � @ s� d dl Z d dlmZ G dd� d�Zej� dd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
edkr|d dlm
Z
e
dddd� dS )� N)�idleConfc @ s2 e Zd Zdd� Zedd� �Zdd� Zd
dd �ZdS )�FormatParagraphc C s
|| _ d S )N)�editwin)�selfr � r �./opt/alt/python36/lib64/python3.6/paragraph.py�__init__ s zFormatParagraph.__init__c C s t jdddddd�| _d S )N�
extensionsr z max-width�int�H )�type�default)r Z GetOption� max_width)�clsr r r �reload s zFormatParagraph.reloadc C s
d | _ d S )N)r )r r r r �close s zFormatParagraph.closeNc C s� |d kr| j n|}| jj}| jj� \}}|rF|rF|j||�}t|�}nt||jd��\}}}}|rpt|||�}n
t ||�}|j
ddd� ||kr�|jd|� |j� |j
||� |j||� |j� n|jd|� |jd� dS )N�insertZselz1.0�end�break)r r �textZget_selection_indices�get�get_comment_header�find_paragraph�index�reformat_comment�reformat_paragraphZ
tag_removeZmark_setZundo_block_start�deleter Zundo_block_stopZsee) r Zevent�limitr �first�last�data�comment_header�newdatar r r �format_paragraph_event# s(
z&FormatParagraph.format_paragraph_event)N)�__name__�
__module__�__qualname__r �classmethodr r r# r r r r r s r c
C sJ t t|jd��\}}| jd| d| �}x:| jd| dd�rbt|�rb|d }| jd| d| �}q*W |}t|�}t|�}x>t|�|kr�t||d � � r�|d }| jd| d| �}qzW d| }|d }| jd| d| �}xL|dk�r(t|�|k�r(t||d � � �r(|d }| jd| d| �}q�W d|d } | ||| j| |�fS )N�.z%d.0z%d.end�<r � r )�mapr
�splitr Zcompare�is_all_whiter �len)
r Zmark�lineno�col�lineZfirst_linenor! Zcomment_header_lenr r r r r r L s, r c C s� | j d�}d}t|�}x ||k r6t|| �r6|d }qW ||krD| S t|| �}|d |k r�t||d � r�t||d �}n|}|d |� }|}x�||k o�t|| � �rTtj d|| �} x�tdt| �d�D ]v}
| |
}|s�q�t|| j� �|ko�||k�r|j|j� � |}|| d }|
d t| �k r�| |
d dkr�|d }q�W |d }q�W |j|j� � |j ||d � � dj
|�S )N�
r r* z(\s+)� � )r, r. r- �
get_indent�re�range�
expandtabs�append�rstrip�extend�join)r r �lines�i�nZindent1Zindent2�new�partialZwords�jZwordr r r r q s<