
    G@d                     P    d Z ddlmZ ddlmZ  G d d          Z e            ZdS )z
Clipboard helper module.
    )QApplication)to_text_stringc                   6    e Zd ZdZdZdZd ZddZddZd Z	dS )ClipboardHelperNc                     t          j                    }t          t          |                                                    S N)r   	clipboardhashr   text)selfr	   s     =lib/python3.11/site-packages/spyder/utils/clipboard_helper.pyget_current_hashz ClipboardHelper.get_current_hash   s0     *,,	N9>>#3#344555    c                     |r|                     dd|z            }t          |          t          |                                          z
  S )zGet indentation for given line.	 )replacelenlstrip)r   r   tab_stop_width_spacess      r   get_line_indentationz$ClipboardHelper.get_line_indentation   sE      	C<<c,A&ABBD4yyT[[]]++++r   c                 |    |                                  | _        |                     ||          | _        || _        dS )zx
        Save the indentation corresponding to the clipboard data.

        Must be called right after copying.
        N)r   metadata_hashr   metadata_indentmetadata_tab_stop_width_spaces)r   preceding_textr   s      r   save_indentationz ClipboardHelper.save_indentation   sD     "2244#881 3  3.C+++r   c                     |                                  | j        k    r#|                     || j                  | j        z
  S dS )zj
        Get remaining lines adjustments needed to keep multiline
        pasted text consistant.
        r   )r   r   r   r   r   )r   r   s     r   remaining_lines_adjustmentz*ClipboardHelper.remaining_lines_adjustment*   sS    
   ""d&888))"79 9 &'(
 qr   r   )
__name__
__module____qualname__r   r   r   r   r   r   r    r   r   r   r      sn        MO%)"6 6 6, , , ,	D 	D 	D 	D    r   r   N)__doc__qtpy.QtWidgetsr   spyder.py3compatr   r   CLIPBOARD_HELPERr#   r   r   <module>r(      st     ( ' ' ' ' ' + + + + + +& & & & & & & &R #?$$   r   