Sindbad~EG File Manager
�
&Μg"2 � �� � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ dd�Z
G d � d
ej � Z G d� d� Zej# � ed
k( rddlmZ eddd�� yy)a An IDLE extension to avoid having very long texts printed in the shell.
A common problem in IDLE's interactive shell is printing of large amounts of
text into the shell. This makes looking at the previous history difficult.
Worse, this can cause IDLE to become very slow, even to the point of being
completely unusable.
This extension will automatically replace long texts with a small button.
Double-clicking this button will remove it and insert the original text instead.
Middle-clicking will copy the text to the clipboard. Right-clicking will open
the text in a separate viewing window.
Additionally, any output can be manually "squeezed" by the user. This includes
output written to the standard error stream ("stderr"), such as exception
messages and their tracebacks.
� N)�
messagebox)�idleConf)� view_text)�Hovertip)�macosxc �N � d}d}d}d}t j d| � D ][ }|j � |z
}||z
}||z
}| | dk( r||kD r||dz
|z z
}|dz
}d}n||||z z
z
}||kD r|dz
}|}|dz
}�] |t | � |z
z
}|dkD r
||dz
|z z
}|S |dz }|S )z�Count the number of lines in a given string.
Lines are counted as if the string was wrapped so that lines are never over
linewidth characters long.
Tabs are considered tabwidth characters long.
� r � z[\t\n]�
)�re�finditer�start�len)�s� linewidth�tabwidth�pos� linecount�current_column�m�numcharss �-/usr/local/lib/python3.12/idlelib/squeezer.py�count_lines_with_wrappingr s � � �H�
�C��I��N�
�[�[��A�
&���7�7�9�s�?���x����(�"��
�S�6�T�>� � �)� �n�q�0�Y�>�>� ���N�I��N�
�h�.�8�*C�D�D�N� � �)��Q�� �!)���q���; '�@ �c�!�f�s�l�"�N�����n�q�(�Y�6�6� �
�� �Q�� ��� c �>