§
    	^µc¾ ã                   ó@  — d dl Z d dlZd dlZddlmZ ddlmZmZ ddlm	Z	m
Z
mZmZmZmZmZ ddlmZ ej        Z ed¦  «        Z ed¦  «        Z ed	¦  «        Z	 d dlZd dlZej         n# eef$ r dZY nw xY w G d
„ dej        ¦  «        Zd„ Z G d„ d¦  «        Z G d„ dee¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z  G d„ de¦  «        Z!d"d„Z"d"d„Z#d„ Z$d"d„Z% ed¦  «         ed¦  «         ed¦  «         ed¦  «        dœZ& G d „ d!¦  «        Z'dS )#é    Né   )Ú_)ÚgetattrÚopen)Ú
diffhelperÚencodingÚerrorÚpatchÚpycompatÚscmutilÚutil)Ú
stringutils’   # To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed from the patch.
s,  #
# If the patch applies cleanly, the edited hunk will immediately be
# added to the record list. If it does not apply cleanly, a rejects file
# will be generated. You can use that when you try again. If all lines
# of the hunk are removed, then the edit is aborted and the hunk is left
# unchanged.
s»   #
# If the patch applies cleanly, the edited patch will immediately
# be finalised. If it does not apply cleanly, rejects files will be
# generated. You can use those when you try again.
c                   ó   — e Zd ZdZdS )ÚfallbackerrorzDError that indicates the client should try to fallback to text mode.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú3/usr/lib/python3/dist-packages/mercurial/crecord.pyr   r   E   s   € € € € € ØNÐNÐNÐNr   r   c                 óB   — t           o|                      d¦  «        dk    S )z»Return True if the user wants to use curses

    This method returns True if curses is found (and that python is built with
    it) and that the user has the correct flag for the ui.
    s   chunkselectors   curses)ÚcursesÚ	interface)Úuis    r   Úcheckcursesr   L   s!   € õ ÐA�b—l’lÐ#3Ñ4Ô4¸	ÒAÐAr   c                   óD   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	dd	„Z
d
„ ZdS )Ú	patchnodezVabstract class for patch graph nodes
    (i.e. patchroot, header, hunk, hunkline)
    c                 ó    — t          d¦  «        ‚©Nó&   method must be implemented by subclass©ÚNotImplementedError©Úselfs    r   Ú
firstchildzpatchnode.firstchildZ   ó   € Ý!Ð"KÑLÔLÐLr   c                 ó    — t          d¦  «        ‚r    r"   r$   s    r   Ú	lastchildzpatchnode.lastchild]   r'   r   c                 ó    — t          d¦  «        ‚)z8Return a list of all of the direct children of this noder!   r"   r$   s    r   Úallchildrenzpatchnode.allchildren`   s   € å!Ð"KÑLÔLÐLr   c                 ó    — t          d¦  «        ‚)zÐ
        Return the closest next item of the same type where there are no items
        of different types between the current item and this closest item.
        If no such item exists, return None.
        r!   r"   r$   s    r   Únextsiblingzpatchnode.nextsiblingd   ó   € õ "Ð"KÑLÔLÐLr   c                 ó    — t          d¦  «        ‚)zÔ
        Return the closest previous item of the same type where there are no
        items of different types between the current item and this closest item.
        If no such item exists, return None.
        r!   r"   r$   s    r   Úprevsiblingzpatchnode.prevsiblingl   r.   r   c                 ó    — t          d¦  «        ‚r    r"   r$   s    r   Ú
parentitemzpatchnode.parentitemt   r'   r   Tc                 ó,  — 	 | j         }n# t          $ r d}Y nw xY w|rT|rR|                      ¦   «         }|€:	 |                      ¦   «                              ¦   «         }n# t          $ r d}Y nw xY w|S |                      ¦   «         }|�|S |                      ¦   «         }|�|S 	 |                      ¦   «                              ¦   «         }|�|S |                      ¦   «                              ¦   «                              ¦   «         S # t          $ r Y dS w xY w)ax  
        Try to return the next item closest to this item, regardless of item's
        type (header, hunk, or hunkline).

        If skipfolded == True, and the current item is folded, then the child
        items that are hidden due to folding will be skipped when determining
        the next item.

        If it is not possible to get the next item, return None.
        FN)ÚfoldedÚAttributeErrorr-   r2   r&   )r%   Ú
skipfoldedÚ
itemfoldedÚnextitemÚitems        r   r8   zpatchnode.nextitemw   sV  € ð	ØœˆJˆJøÝð 	ð 	ð 	ØˆJˆJˆJð	øøøàð 	˜*ð 	Ø×'Ò'Ñ)Ô)ˆHØÐð$Ø#ŸšÑ0Ô0×<Ò<Ñ>Ô>�H�HøÝ%ð $ð $ð $Ø#�H�H�Hð$øøøàˆOð —?’?Ñ$Ô$ˆDØÐØ�ð ×#Ò#Ñ%Ô%ˆDØÐØ�ð
à—’Ñ(Ô(×4Ò4Ñ6Ô6�ØÐ#Ø�Kð —’Ñ(Ô(×3Ò3Ñ5Ô5×AÒAÑCÔCÐCøå!ð ð ð Ø�t�tðøøøs5   ‚
 Š˜·&A ÁA-Á,A-Â#)D Ã7D Ä
DÄDc                 óÖ   — |                       ¦   «         }|�@|                     ¦   «         }|�(|j        s!|                     ¦   «         }|�	|j        s|S |S |S |                      ¦   «         S )zÌ
        Try to return the previous item closest to this item, regardless of
        item's type (header, hunk, or hunkline).

        If it is not possible to get the previous item, return None.
        )r0   r)   r4   r2   )r%   r0   ÚprevsiblinglastchildÚprevsiblinglclcs       r   Úprevitemzpatchnode.previtem¥   s�   € ð ×&Ò&Ñ(Ô(ˆØÐ"Ø#.×#8Ò#8Ñ#:Ô#:Ð Ø$Ð0¸+Ô:LÐ0Ø"6×"@Ò"@Ñ"BÔ"B�à#Ð/Ø.Ô5ð 0à*Ð*à/Ð/à"Ð"ð �ŠÑ Ô Ð r   N©T)r   r   r   r   r&   r)   r+   r-   r0   r2   r8   r=   r   r   r   r   r   U   s®   € € € € € ðð ðMð Mð MðMð Mð MðMð Mð MðMð Mð MðMð Mð MðMð Mð Mð,ð ,ð ,ð ,ð\!ð !ð !ð !ð !r   r   c                   ó   — e Zd ZdZd„ ZdS )r
   z8
    list of header objects representing the patch.
    c                 óH   — |                       |¦  «         | D ]	}| |_        Œ
d S ©N)Úextendr
   )r%   Ú
headerlistÚheaders      r   Ú__init__zpatch.__init__Å   s6   € Ø�Š�JÑÔÐàð 	 ð 	 ˆFØˆFŒLˆLð	 ð 	 r   N)r   r   r   r   rE   r   r   r   r
   r
   À   s-   € € € € € ðð ð ð  ð  ð  ð  r   r
   c                   óH   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ ZdS )ÚuiheaderzIpatch header

    xxx shouldn't we move this to mercurial/patch.py ?
    c                 óŒ   ‡ — |‰ _         d‰ _        d‰ _        d‰ _        d ‰ _        d‰ _        ˆ fd„‰ j        D ¦   «         ‰ _        d S )NTFc                 ó0   •— g | ]}t          |‰¦  «        ‘ŒS r   ©Úuihunk)Ú.0Úhr%   s     €r   ú
<listcomp>z%uiheader.__init__.<locals>.<listcomp>â   s!   ø€ Ð:Ð:Ð:¨!•f˜Q ‘o”oÐ:Ð:Ð:r   )ÚnonuiheaderÚappliedÚpartialr4   r
   ÚneverunfoldedÚhunks)r%   rD   s   ` r   rE   zuiheader.__init__Ò   sX   ø€ Ø!ˆÔàˆŒð ˆŒð ˆŒð ˆŒ
ð "ˆÔØ:Ð:Ð:Ð:¨t¬zÐ:Ñ:Ô:ˆŒ
ˆ
ˆ
r   c                 óp   — t          ¦   «         }|                      |¦  «         |                     ¦   «         S rA   ©ÚstringioÚprettyÚgetvalue©r%   Úxs     r   Ú	prettystrzuiheader.prettysträ   ó(   € Ý‰JŒJˆØ�Š�A‰ŒˆØ�zŠz‰|Œ|Ðr   c                 ó˜   — t          | j        ¦  «        }| j                             | ¦  «        }||dz
  k     r| j        |dz            }|S d S ©Nr   )Úlenr
   Úindex)r%   ÚnumheadersinpatchÚindexofthisheaderÚ
nextheaders       r   r-   zuiheader.nextsiblingé   sT   € Ý ¤
™OœOÐØ œJ×,Ò,¨TÑ2Ô2ÐàÐ0°1Ñ4Ò4Ð4ØœÐ$5¸Ñ$9Ô:ˆJØÐà�4r   c                 ój   — | j                              | ¦  «        }|dk    r| j         |dz
           }|S d S ©Nr   r   )r
   r`   )r%   rb   Úpreviousheaders      r   r0   zuiheader.prevsiblingó   s@   € Ø œJ×,Ò,¨TÑ2Ô2ÐØ˜qÒ Ð Ø!œZÐ(9¸AÑ(=Ô>ˆNØ!Ð!à�4r   c                 ó   — dS )zj
        there is no 'real' parent item of a header that can be selected,
        so return None.
        Nr   r$   s    r   r2   zuiheader.parentitemû   s	   € ð
 ˆtr   c                 óP   — t          | j        ¦  «        dk    r| j        d         S dS ©úLreturn the first child of this item, if one exists.  otherwise
        None.r   N©r_   rS   r$   s    r   r&   zuiheader.firstchild  s(   € õ ˆtŒz‰?Œ?˜QÒÐØ”:˜a”=Ð à�4r   c                 óP   — t          | j        ¦  «        dk    r| j        d         S dS ©úKreturn the last child of this item, if one exists.  otherwise
        None.r   éÿÿÿÿNrk   r$   s    r   r)   zuiheader.lastchild
  s(   € õ ˆtŒz‰?Œ?˜QÒÐØ”:˜b”>Ð!à�4r   c                 ó   — | j         S ©z8return a list of all of the direct children of this node)rS   r$   s    r   r+   zuiheader.allchildren  s
   € àŒzÐr   c                 ó,   — t          | j        |¦  «        S rA   )r   rO   ©r%   Únames     r   Ú__getattr__zuiheader.__getattr__  s   € Ý�tÔ'¨Ñ.Ô.Ð.r   N)r   r   r   r   rE   r[   r-   r0   r2   r&   r)   r+   ru   r   r   r   rG   rG   Ì   s¥   € € € € € ðð ð
;ð ;ð ;ð$ð ð ð
ð ð ðð ð ðð ð ðð ð ðð ð ðð ð ð/ð /ð /ð /ð /r   rG   c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
Ú
uihunklinez#represents a changed line in a hunkc                 ó>   — || _         d| _        || _        d| _        d S ©NTF)ÚlinetextrP   Úhunkr4   )r%   rz   r{   s      r   rE   zuihunkline.__init__  s$   € Ø ˆŒØˆŒàˆŒ	ð ˆŒˆˆr   c                 ó   — | j         S rA   )rz   r$   s    r   r[   zuihunkline.prettystr&  s
   € ØŒ}Ðr   c                 ó¶   — t          | j        j        ¦  «        }| j        j                             | ¦  «        }||dz
  k     r| j        j        |dz            }|S d S r^   )r_   r{   Úchangedlinesr`   )r%   ÚnumlinesinhunkÚindexofthislineÚnextlines       r   r-   zuihunkline.nextsibling)  sZ   € Ý˜TœYÔ3Ñ4Ô4ˆØœ)Ô0×6Ò6°tÑ<Ô<ˆà˜^¨aÑ/Ò/Ð/Ø”yÔ-¨oÀÑ.AÔBˆHØˆOà�4r   c                 ó~   — | j         j                             | ¦  «        }|dk    r| j         j        |dz
           }|S d S re   )r{   r~   r`   )r%   r€   Úpreviouslines      r   r0   zuihunkline.prevsibling3  sD   € Øœ)Ô0×6Ò6°tÑ<Ô<ˆØ˜QÒÐØœ9Ô1°/ÀAÑ2EÔFˆLØÐà�4r   c                 ó   — | j         S ©z%return the parent to the current item)r{   r$   s    r   r2   zuihunkline.parentitem;  s
   € àŒyÐr   c                 ó   — dS )rj   Nr   r$   s    r   r&   zuihunkline.firstchild?  ó	   € ð ˆtr   c                 ó   — dS )rn   Nr   r$   s    r   r)   zuihunkline.lastchildE  r‡   r   N)r   r   r   r   rE   r[   r-   r0   r2   r&   r)   r   r   r   rw   rw     sƒ   € € € € € Ø-Ð-ðð ð ðð ð ðð ð ðð ð ðð ð ðð ð ðð ð ð ð r   rw   c                   ón   — e Zd ZdZdZd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ ZeZd„ Zd„ Zd„ Zd„ ZdS )rK   z9ui patch hunk, wraps a hunk and keep track of ui behavioré   c                 ó–   ‡ — |‰ _         ˆ fd„|j        D ¦   «         ‰ _        |‰ _        ‰ j        ‰ _        d‰ _        d‰ _        d‰ _        d S )Nc                 ó0   •— g | ]}t          |‰¦  «        ‘ŒS r   )rw   )rL   Úliner%   s     €r   rN   z#uihunk.__init__.<locals>.<listcomp>S  s#   ø€ ÐJÐJÐJ¸�Z¨¨dÑ3Ô3ÐJÐJÐJr   TF)	Ú_hunkr{   r~   rD   ÚremovedÚoriginalremovedr4   rP   rQ   )r%   r{   rD   s   `  r   rE   zuihunk.__init__Q  sV   ø€ ØˆŒ
ØJÐJÐJÐJÀÄ	ÐJÑJÔJˆÔØˆŒà#œ|ˆÔð ˆŒàˆŒð ˆŒˆˆr   c                 ó¶   — t          | j        j        ¦  «        }| j        j                             | ¦  «        }||dz
  k     r| j        j        |dz            }|S d S r^   )r_   rD   rS   r`   )r%   ÚnumhunksinheaderÚindexofthishunkÚnexthunks       r   r-   zuihunk.nextsibling`  s\   € Ý˜tœ{Ô0Ñ1Ô1ÐØœ+Ô+×1Ò1°$Ñ7Ô7ˆàÐ-°Ñ1Ò1Ð1Ø”{Ô(¨¸1Ñ)<Ô=ˆHØˆOà�4r   c                 ó~   — | j         j                             | ¦  «        }|dk    r| j         j        |dz
           }|S d S re   )rD   rS   r`   )r%   r“   Úprevioushunks      r   r0   zuihunk.prevsiblingj  sD   € Øœ+Ô+×1Ò1°$Ñ7Ô7ˆØ˜QÒÐØœ;Ô,¨_¸qÑ-@ÔAˆLØÐà�4r   c                 ó   — | j         S r…   )rD   r$   s    r   r2   zuihunk.parentitemr  s
   € àŒ{Ðr   c                 óP   — t          | j        ¦  «        dk    r| j        d         S dS ri   ©r_   r~   r$   s    r   r&   zuihunk.firstchildv  s-   € õ ˆtÔ Ñ!Ô! AÒ%Ð%ØÔ$ QÔ'Ð'à�4r   c                 óP   — t          | j        ¦  «        dk    r| j        d         S dS rm   r™   r$   s    r   r)   zuihunk.lastchild~  s-   € õ ˆtÔ Ñ!Ô! AÒ%Ð%ØÔ$ RÔ(Ð(à�4r   c                 ó   — | j         S rq   )r~   r$   s    r   r+   zuihunk.allchildren†  s   € àÔ Ð r   c                 ó‚   — t          d„ | j        D ¦   «         ¦  «        }t          d„ | j        D ¦   «         ¦  «        }||fS )zchangedlines -> (n+,n-)c                 ón   — g | ]2}|j         ¯	|                     ¦   «                              d ¦  «        ¯0|‘Œ3S )ó   +©rP   r[   Ú
startswith©rL   Úls     r   rN   z'uihunk.countchanges.<locals>.<listcomp>�  óP   € ð ð ð àØ”9ðð "#§¢¡¤×!9Ò!9¸$Ñ!?Ô!?ðØðð ð r   c                 ón   — g | ]2}|j         ¯	|                     ¦   «                              d ¦  «        ¯0|‘Œ3S )ó   -rŸ   r¡   s     r   rN   z'uihunk.countchanges.<locals>.<listcomp>”  r£   r   r™   )r%   ÚaddÚrems      r   Úcountchangeszuihunk.countchangesŠ  sk   € åðð àÔ*ðñ ô ñ
ô 
ˆõ ðð àÔ*ðñ ô ñ
ô 
ˆð �Cˆxˆr   c                 ó„  — | j         | j        z
  }t          | j        ¦  «        t          | j        ¦  «        z   |z   }| j        r | j        d         t
          j        k    r|dz  }|| j        z   }|| j        z   }| j        | j	        }}|dk    r|dk    r|dz  }|dk    r|dk    r|dz  }d||||| j
        o	d| j
        z   fz  }|S )Nro   r   r   s   @@ -%d,%d +%d,%d @@%s
ó    )r�   r�   r_   ÚbeforeÚafterr   ÚMISSING_NEWLINE_MARKERÚaddedÚfromlineÚtolineÚproc)r%   ÚremovedconvertedtocontextÚ
contextlenÚfromlenÚtolenr¯   r°   Ú
fromtolines           r   Úgetfromtolinezuihunk.getfromtolineœ  sñ   € à$(Ô$8¸4¼<Ñ$GÐ!õ �”ÑÔ�s 4¤:™œÑ.Ð1JÑJð 	ð Œ:ð 	˜$œ* Rœ.­JÔ,MÒMÐMØ˜!‰OˆJØ˜tœ|Ñ+ˆØ˜TœZÑ'ˆð  œ=¨$¬+�&ˆØ�qŠ=ˆ=Ø˜!Š|ˆ|Ø˜A‘�Ø˜Šzˆz˜f qšj˜jØ˜!‘�à/ØØØØØŒIÐ,˜4 $¤)Ñ+ð3
ñ 
ˆ
ð Ðr   c                 óê  — |                       ¦   «         \  | _        | _        |                     |                      ¦   «         ¦  «         g }| j        D ]h}|                     ¦   «         }|j        r|                     |¦  «         Œ3| 	                    d¦  «        r |                     d|dd …         z   ¦  «         Œi|                     d 
                    | j        |z   | j        z   ¦  «        ¦  «         d S )Nr¥   rª   r   r   )r¨   r®   r�   Úwriter·   r~   r[   rP   Úappendr    Újoinr«   r¬   )r%   ÚfpÚhunklinelistÚchangedlineÚchangedlinestrs        r   r¹   zuihunk.write¾  sñ   € à#'×#4Ò#4Ñ#6Ô#6Ñ ˆŒ
�D”LØ
�Š�×#Ò#Ñ%Ô%Ñ&Ô&Ð&àˆð  Ô,ð 	?ð 	?ˆKØ(×2Ò2Ñ4Ô4ˆNØÔ"ð ?Ø×#Ò# NÑ3Ô3Ð3Ð3Ø×*Ò*¨4Ñ0Ô0ð ?Ø×#Ò# D¨>¸!¸"¸"Ô+=Ñ$=Ñ>Ô>Ð>øà
�Š�—’˜$œ+¨Ñ4°t´zÑAÑBÔBÑCÔCÐCÐCÐCr   c                 óp   — t          ¦   «         }|                      |¦  «         |                     ¦   «         S rA   rU   rY   s     r   r[   zuihunk.prettystrÑ  r\   r   c           	      ó¶  — g }g }d}| j         D ]Ý}|j        }|j        t          j        k    rd}Œ!|j        rf|                     d¦  «        r|                     |dd…         ¦  «         Œ[|                     d¦  «        r|                     |dd…         ¦  «         ŒŽ|                     d¦  «        r:|                     |dd…         ¦  «         |                     |dd…         ¦  «         ŒÞd„ |D ¦   «         d„ |D ¦   «         z   }|r|r|d	         dd	…         |d	<   | j        }t          j	        |j
        |j        |j        |j        |j        ||j        ¦  «        S )
aS  return a recordhunk which is the reverse of the hunk

        Assuming the displayed patch is diff(A, B) result. The returned hunk is
        intended to be applied to B, instead of A.

        For example, when A is "0
1
2
6
" and B is "0
3
4
5
6
", and
        the user made the following selection:

                 0
            [x] -1           [x]: selected
            [ ] -2           [ ]: not selected
            [x] +3
            [ ] +4
            [x] +5
                 6

        This function returns a hunk like:

                 0
                -3
                -4
                -5
                +1
                +4
                 6

        Note "4" was first deleted then added. That's because "4" exists in B
        side and "-4" must exist between "-3" and "-5" to make the patch
        applicable to B.
        FTrž   r   Nr¥   c                 ó   — g | ]}d |z  ‘ŒS )s   -%sr   r¡   s     r   rN   z&uihunk.reversehunk.<locals>.<listcomp>  s   € Ð)Ð)Ð)˜q�˜‘
Ð)Ð)Ð)r   c                 ó   — g | ]}d |z  ‘ŒS )s   +%sr   r¡   s     r   rN   z&uihunk.reversehunk.<locals>.<listcomp>  s   € Ð,FÐ,FÐ,F¸A¨V°a©ZÐ,FÐ,FÐ,Fr   ro   )r~   rz   r   r­   rP   r    rº   rŽ   ÚpatchmodÚ
recordhunkrD   r°   r¯   r±   r«   r¬   )r%   ÚdelsÚaddsÚnoeolr�   Útextr{   rM   s           r   Úreversehunkzuihunk.reversehunkÖ  sy  € ð> ˆØˆØˆØÔ%ð 	&ð 	&ˆDØ”=ˆDØŒ}¥
Ô AÒAÐAØ�ØØŒ|ð &Ø—?’? 4Ñ(Ô(ð *Ø—K’K  Q R R¤Ñ)Ô)Ð)Ð)Ø—_’_ TÑ*Ô*ð *Ø—K’K  Q R R¤Ñ)Ô)Ð)øØ—’ Ñ&Ô&ð &Ø—’˜D   œHÑ%Ô%Ð%Ø—’˜D   œHÑ%Ô%Ð%øØ)Ð) DÐ)Ñ)Ô)Ð,FÐ,FÀÐ,FÑ,FÔ,FÑFˆØð 	%�Tð 	%à˜B”x   ”}ˆD�‰HØŒJˆÝÔ"ØŒH�a”h ¤
¨A¬F°A´H¸dÀAÄGñ
ô 
ð 	
r   c                 ó,   — t          | j        |¦  «        S rA   )r   rŽ   rs   s     r   ru   zuihunk.__getattr__  s   € Ý�t”z 4Ñ(Ô(Ð(r   c                 ó>   — d|                       ¦   «         | j        fz  S )Nz<hunk %r@%d>)Úfilenamer¯   r$   s    r   Ú__repr__zuihunk.__repr__  s   € Ø §¢¡¤°$´-Ð @Ñ@Ð@r   N)r   r   r   r   Ú
maxcontextrE   r-   r0   r2   r&   r)   r+   r¨   r·   r¹   rW   r[   rÊ   ru   rÎ   r   r   r   rK   rK   L  s  € € € € € ØCÐCà€Jðð ð ðð ð ðð ð ðð ð ðð ð ðð ð ð!ð !ð !ðð ð ð$ ð  ð  ðDDð Dð Dð" €Fðð ð ð
6
ð 6
ð 6
ðp)ð )ð )ðAð Að Að Að Ar   rK   c                 óî  — t          |¦  «        }d„ |D ¦   «         }t          |¦  «        dk    rg i fS d„ |D ¦   «         } || ||¬¦  «        }g }|D ]¡}|j        r˜|                     ¦   «         s"t          d„ |j        D ¦   «         ¦  «        dk    rb|                     |¦  «         d}	|j        D ]C}
|
j        r(|                     |
¦  «         |	r|
xj        |	z  c_        Œ1|	|
j        |
j        z
  z  }	ŒDŒ¢||fS )z:interactively filter patch chunks into applied-only chunksc                 óF   — g | ]}t          |t          j        ¦  «        ¯|‘ŒS r   )Ú
isinstancerÄ   rD   )rL   Úcs     r   rN   zfilterpatch.<locals>.<listcomp>  s)   € ÐCÐCÐC�Q¥J¨qµ(´/Ñ$BÔ$BÐCˆqÐCÐCÐCr   r   c                 ó,   — g | ]}t          |¦  «        ‘ŒS r   )rG   ©rL   rM   s     r   rN   zfilterpatch.<locals>.<listcomp>  s   € Ð.Ð.Ð. •˜!‘”Ð.Ð.Ð.r   )Ú	operationc                 ó    — g | ]}|j         ¯	|‘ŒS r   ©rP   rÕ   s     r   rN   zfilterpatch.<locals>.<listcomp>&  s   € Ð!DÐ!DÐ!D¨¸!¼)Ð!D !Ð!DÐ!DÐ!Dr   )	Úlistr_   rP   ÚspecialrS   rº   r°   r�   r®   )r   ÚchunksÚchunkselectorrÖ   ÚheadersÚ	uiheadersÚretÚappliedhunklistÚhdrÚ	fixoffsetÚhnks              r   Úfilterpatchrä     s@  € å�&‰\Œ\€Fð DÐC˜&ÐCÑCÔC€Gõ ˆ7�|„|�qÒÐØ�2ˆvˆØ.Ð. gÐ.Ñ.Ô.€Ið ˆ-˜˜I°Ð
;Ñ
;Ô
;€CØ€OØð 9ð 9ˆØŒ;ð 	9Ø�KŠK‰MŒMð	9Ý Ð!DÐ!D¨S¬YÐ!DÑ!DÔ!DÑEÔEÈÒIÐIà×"Ò" 3Ñ'Ô'Ð'ØˆIØ”yð 	9ð 	9�Ø”;ð 9Ø#×*Ò*¨3Ñ/Ô/Ð/ð !ð 0à˜
œ
 iÑ/˜
œ
øà ¤¨s¬yÑ!8Ñ8�I�Iøà˜SÐ!Ð!r   c                 óH  — |                       t          d¦  «        ¦  «         t          || |¦  «        }t          ¦   «         x}}t	          j        t          d¦  «        rt          j        t          j        ¦  «        }	 t	          j	        ¦   «         5  t          j        |j        ¦  «         ddd¦  «         n# 1 swxY w Y   |j        �|j        ‚	 ||urt          j        t          j        |¦  «         n)# ||ur t          j        t          j        |¦  «         w w xY w|j        S )zk
    curses interface to get selection of chunks, and mark the applied flags
    of the chosen chunks.
    s   starting interactive selection
s   SIGTSTPN)r¹   r   ÚcurseschunkselectorÚobjectr   ÚsafehasattrÚsignalÚ	getsignalÚSIGTSTPÚwith_lc_ctyper   ÚwrapperÚmainÚinitexcÚopts)r   rC   rÖ   rÜ   ÚorigsigtstpÚsentinels         r   rÜ   rÜ   8  sP  € ð
 ‡H‚H�QÐ2Ñ3Ô3Ñ4Ô4Ð4Ý'¨
°B¸	ÑBÔB€MÝ#™XœXÐ%€K�(ÝÔ� 
Ñ+Ô+ð 7ÝÔ&¥v¤~Ñ6Ô6ˆð7ÝÔÑ!Ô!ð 	/ð 	/ÝŒN˜=Ô-Ñ.Ô.Ð.ð	/ð 	/ð 	/ñ 	/ô 	/ð 	/ð 	/ð 	/ð 	/ð 	/ð 	/øøøð 	/ð 	/ð 	/ð 	/àÔ Ð,ØÔ'Ð'ð -ð ˜hÐ&Ð&ÝŒM�&œ.¨+Ñ6Ô6Ð6øøð ˜hÐ&Ð&ÝŒM�&œ.¨+Ñ6Ô6Ð6Ð6ð 'øøøàÔÐs0   Á=C4 ÂB6Â*C4 Â6B:Â:C4 Â=B:Â>C4 Ã4&Dc                 ó   ‡ ‡— ˆˆ fd„}|S )Nc                  ó   •—  ‰‰g| ¢R i |¤ŽS rA   r   )ÚargsÚkwargsÚfÚtestfns     €€r   Úuztestdecorator.<locals>.uO  s#   ø€ Øˆq�Ð)˜$Ð)Ð)Ð) &Ð)Ð)Ð)r   r   )rø   r÷   rù   s   `` r   Útestdecoratorrú   N  s)   øø€ ð*ð *ð *ð *ð *ð *ð €Hr   c                 óŠ  — t          |||¦  «        } G d„ d¦  «        } |¦   «         |_        | rŽt          j                             | ¦  «        rot          | d¦  «        }d„ |                     ¦   «         D ¦   «         }|                     ¦   «          	 |                     | 	                    d¦  «        d¬¦  «        rnŒ,|j
        S )zi
    test interface to get selection of chunks, and mark the applied flags
    of the chosen chunks.
    c                   ó   — e Zd Zd„ Zd„ ZdS )ú&testchunkselector.<locals>.dummystdscrc                 ó   — d S rA   r   r$   s    r   Úclearz,testchunkselector.<locals>.dummystdscr.clear]  ó   € ØˆDr   c                 ó   — d S rA   r   r$   s    r   Úrefreshz.testchunkselector.<locals>.dummystdscr.refresh`  r   r   N)r   r   r   rÿ   r  r   r   r   Údummystdscrrý   \  s2   € € € € € ð	ð 	ð 	ð	ð 	ð 	ð 	ð 	r   r  ó   rc                 ó8   — g | ]}|                      d ¦  «        ‘ŒS )ú
)Úrstrip)rL   rZ   s     r   rN   z%testchunkselector.<locals>.<listcomp>g  s"   € ÐBÐBÐB¨1˜Ÿš ™œÐBÐBÐBr   Tr   ©Útest)ræ   ÚstdscrÚosÚpathÚexistsr   Ú	readlinesÚcloseÚhandlekeypressedÚpoprð   )rø   r   rC   rÖ   rÜ   r  ÚtestfÚtestcommandss           r   Útestchunkselectorr  U  sä   € õ
 (¨
°B¸	ÑBÔB€Mðð ð ð ð ñ ô ð ð '˜;™=œ=€MÔØð •"”'—.’. Ñ(Ô(ð Ý�V˜TÑ"Ô"ˆàBÐB°·²Ñ0AÔ0AÐBÑBÔBˆØ�Š‰Œˆð	Ø×-Ò-¨l×.>Ò.>¸qÑ.AÔ.AÈÐ-ÑMÔMð Øð	ð ÔÐr   s   Select hunks to applys   Select hunks to discards   Select hunks to keeps   Select hunks to record)s   applys   discards   keepNc                   ó\  — e Zd Zd2d„Zd„ Zd„ Zd„ Zd„ Zd3d„Zd	„ Z	d
„ Z
d„ Zd„ Zd„ Zd2d„Zd„ Zd„ Zd„ Zd4d„Zd„ Z	 	 	 	 	 	 	 	 d5d„Zd„ Zd„ Zd„ Zd„ Z	 d6d„Z	 d6d„Zd7d„Zd8d„Z	 d9d„Zd„ Zd „ Z	 d:d!„Z 	 d;d"„Z!d#„ Z"	 d<d$„Z#d%„ Z$d&„ Z%d'„ Z&d(„ Z'd)„ Z(d*„ Z)d+„ Z*d,„ Z+d4d-„Z,d.„ Z-d3d/„Z.d0„ Z/d1„ Z0dS )=ræ   Nc                 ó„  — t          |¦  «        | _        || _        i | _        d | _        g | _        |D ];}| j                             |¦  «         | j                             |j        ¦  «         Œ<i | _	        i | _
        t          j        | j                             dd¦  «        ¦  «        }|du| _        | j        d         | _        d | _        d| _        d | _        d| _        d| _        d| _        d| _        d | _        d| _        d| _        d| _        d	| _        |t8          vrt;          j        d
|z  ¦  «        ‚|| _        d S )Ns   uis   colorFr   rŠ   é   r   r   Ts   unexpected operation: %s) r
   rC   r   rð   ÚerrorstrÚ	chunklistrº   rB   rS   Ú
colorpairsÚcolorpairnamesr   Ú	parseboolÚconfigÚusecolorÚcurrentselecteditemÚlastapplieditemÚselecteditemstartlineÚselecteditemendlineÚheaderindentnumcharsÚhunkindentnumcharsÚhunklineindentnumcharsÚfirstlineofpadtoprintÚnumpadlinesÚnumstatuslinesÚlinesprintedtopadsofarÚcommenttextÚwaslasttoggleallappliedÚ_headermessagesr	   ÚProgrammingErrorrÖ   )r%   rC   r   rÖ   rM   Úuicolors         r   rE   zcurseschunkselector.__init__x  sb  € å 
Ñ+Ô+ˆŒàˆŒØˆŒ	àˆŒàˆŒØð 	+ð 	+ˆAØŒN×!Ò! !Ñ$Ô$Ð$ØŒN×!Ò! !¤'Ñ*Ô*Ð*Ð*ð ˆŒà ˆÔõ Ô& t¤w§~¢~°e¸XÑ'FÔ'FÑGÔGˆØ uÐ,ˆŒð $(¤?°1Ô#5ˆÔ Ø#ˆÔð &'ˆÔ"Ø#'ˆÔ ð %&ˆÔ!Ø"#ˆÔØ&'ˆÔ#ð &'ˆÔ"ð  ˆÔàˆÔð '(ˆÔ#ð ˆÔð (,ˆÔ$ð �OÐ+Ð+ÝÔ(Ø+¨iÑ7ñô ð ð #ˆŒˆˆr   c                 óR   — | j         }|                     ¦   «         }|€|}|| _         dS )aM  
        try to select the previous item to the current item that has the
        most-indented level.  for example, if a hunk is selected, try to select
        the last hunkline of the hunk prior to the selected hunk.  or, if
        the first hunkline of a hunk is currently selected, then select the
        hunk itself.
        N)r  r=   ©r%   Úcurrentitemr8   s      r   Úuparroweventz curseschunkselector.uparroweventº  s8   € ð Ô.ˆà×'Ò'Ñ)Ô)ˆàÐð #ˆHà#+ˆÔ Ð Ð r   c                 ó¦   — | j         }|                     ¦   «         }|€|                     ¦   «         }|€|}|| _         |                      ¦   «          dS )zË
        select (if possible) the previous item on the same level as the
        currently selected item.  otherwise, select (if possible) the
        parent-item of the currently selected item.
        N)r  r0   r2   Úrecenterdisplayedarear0  s      r   Úuparrowshifteventz%curseschunkselector.uparrowshifteventÍ  sa   € ð Ô.ˆØ×*Ò*Ñ,Ô,ˆàÐØ"×-Ò-Ñ/Ô/ˆHØÐð #ˆHà#+ˆÔ Ø×"Ò"Ñ$Ô$Ð$Ð$Ð$r   c                 óR   — | j         }|                     ¦   «         }|€|}|| _         dS )ag  
        try to select the next item to the current item that has the
        most-indented level.  for example, if a hunk is selected, select
        the first hunkline of the selected hunk.  or, if the last hunkline of
        a hunk is currently selected, then select the next hunk, if one exists,
        or if not, the next header if one exists.
        N)r  r8   r0  s      r   Údownarroweventz"curseschunkselector.downarroweventà  s6   € ð Ô.ˆà×'Ò'Ñ)Ô)ˆàÐØ"ˆHà#+ˆÔ Ð Ð r   c                 óò   — | j         }|                     ¦   «         }|€:	 |                     ¦   «                              ¦   «         }n# t          $ r d}Y nw xY w|€|}|| _         |                      ¦   «          dS )zê
        select (if possible) the next item on the same level as the currently
        selected item.  otherwise, select (if possible) the next item on the
        same level as the parent item of the currently selected item.
        N)r  r-   r2   r5   r4  r0  s      r   Údownarrowshifteventz'curseschunkselector.downarrowshifteventò  s˜   € ð Ô.ˆØ×*Ò*Ñ,Ô,ˆàÐð Ø&×1Ò1Ñ3Ô3×?Ò?ÑAÔA��øÝ!ð  ð  ð  à���ð øøøð Ðà"ˆHà#+ˆÔ Ø×"Ò"Ñ$Ô$Ð$Ð$Ð$s   Ÿ&A ÁAÁAFc                 óP  ‡— | j         Šˆfd„}‰                     ¦   «         }|�, ||¦  «        s!|                     ¦   «         }|� ||¦  «        ¯!|€‰}n2|                     ¦   «         }|�|j        r|                      |¦  «         || _         |s|                      ¦   «          d S d S )Nc                 ó>   •— t          | t          ‰¦  «        ¦  «        S rA   )rÒ   Útype)r9   r1  s    €r   ú<lambda>z2curseschunkselector.nextsametype.<locals>.<lambda>
  s   ø€ ¥
¨4µ°kÑ1BÔ1BÑ CÔ C€ r   )r  r8   r2   r4   Útogglefoldedr4  )r%   r	  Úsametyper8   Úparentr1  s        @r   Únextsametypez curseschunkselector.nextsametype  sÚ   ø€ ØÔ.ˆØCÐCÐCÐCˆØ×'Ò'Ñ)Ô)ˆàÐ"¨8¨8°HÑ+=Ô+=Ð"Ø×(Ò(Ñ*Ô*ˆHð Ð"¨8¨8°HÑ+=Ô+=Ð"ð ÐØ"ˆHˆHà×(Ò(Ñ*Ô*ˆFØÐ! f¤mÐ!Ø×!Ò! &Ñ)Ô)Ð)à#+ˆÔ Øð 	)Ø×&Ò&Ñ(Ô(Ð(Ð(Ð(ð	)ð 	)r   c                 óŠ   — | j         }|                     ¦   «         }|j        r|                      |¦  «         |€|}|| _         dS )zL
        select (if possible) the first of this item's child-items.
        N)r  r&   r4   r>  r0  s      r   Úrightarroweventz#curseschunkselector.rightarrowevent  sW   € ð Ô.ˆØ×)Ò)Ñ+Ô+ˆð Ôð 	+Ø×Ò˜kÑ*Ô*Ð*àÐà"ˆHà#+ˆÔ Ð Ð r   c                 óô   — | j         }t          |t          ¦  «        s|j        s|                      |¬¦  «         dS |                     ¦   «         }|€|}|j        s|                      |¬¦  «         || _         dS )z·
        if the current item can be folded (i.e. it is an unfolded header or
        hunk), then fold it.  otherwise try select (if possible) the parent
        of this item.
        ©r9   N)r  rÒ   rw   r4   r>  r2   r0  s      r   Úleftarroweventz"curseschunkselector.leftarrowevent,  s”   € ð Ô.ˆõ ˜+¥zÑ2Ô2ð 	ØÔ%ð Ø×!Ò! {Ð!Ñ3Ô3Ð3Ø�ð ×)Ò)Ñ+Ô+ˆàÐà"ˆHØ”?ð 1Ø×!Ò! xÐ!Ñ0Ô0Ð0à#+ˆÔ Ð Ð r   c                 óÀ   — | j         }t          |t          ¦  «        r|j        s|                      |¬¦  «         dS 	 |                     ¦   «         }|€n|}Œ|| _         dS )z
        select the header of the current item (or fold current item if the
        current item is already a header).
        rE  N)r  rÒ   rG   r4   r>  r2   r0  s      r   Úleftarrowshifteventz'curseschunkselector.leftarrowshifteventE  s~   € ð
 Ô.ˆå�k¥8Ñ,Ô,ð 	ØÔ%ð Ø×!Ò! {Ð!Ñ3Ô3Ð3Ø�ð	'Ø"×-Ò-Ñ/Ô/ˆHØÐØà&�ð	'ð $/ˆÔ Ð Ð r   c                 óî   — | j         }| j        }| j        }|| j        z   | j        z
  dz
  }|dz   }|dz
  }||k    r|                      ||z
  ¦  «         dS ||k     r|                      ||z
  ¦  «         dS dS )z6scroll the screen to fully show the currently-selectedr   rŠ   N)r!  r"  r&  Úyscreensizer(  Úscrolllines)r%   ÚselstartÚselendÚpadstartÚpadendÚpadstartbufferedÚpadendbuffereds          r   Úupdatescrollz curseschunkselector.updatescroll[  s§   € àÔ-ˆØÔ)ˆàÔ-ˆØ˜DÔ,Ñ,¨tÔ/BÑBÀQÑFˆð $ a™<ÐØ !™ˆà�NÒ"Ð"Ø×Ò˜V nÑ4Ñ5Ô5Ð5Ð5Ð5ØÐ(Ò(Ð(à×Ò˜XÐ(8Ñ8Ñ9Ô9Ð9Ð9Ð9ð )Ð(r   c                 ó’   — | xj         |z  c_         | j         dk     rd| _         | j         | j        dz
  k    r| j        dz
  | _         dS dS )z>scroll the screen up (down) by numlines when numlines >0 (<0).r   r   N)r&  r'  )r%   Únumliness     r   rK  zcurseschunkselector.scrolllinesm  s`   € àÐ"Ô" hÑ.Ð"Ô"ØÔ%¨Ò)Ð)Ø)*ˆDÔ&ØÔ%¨Ô(8¸1Ñ(<Ò<Ð<Ø)-Ô)9¸AÑ)=ˆDÔ&Ð&Ð&ð =Ð<r   c                 ó  — |€| j         }|| _        |j         |_        t          |t          ¦  «        r]d|_        |j        r$|j        D ]}d|_        |j        D ]	}d|_        Œ
ŒdS |j        D ]!}d|_        d|_        |j        D ]	}d|_        Œ
Œ"dS t          |t          ¦  «        r©d|_        |j        D ]}|j        |_        Œd„ |j	        j        D ¦   «         }d|v}d|v}d„ |j	        j        D ¦   «         }d|v }|r5|j	         
                    ¦   «         sd|j	        _        d|j	        _        dS dS d|j	        _        |p| |j	        _        dS t          |t          ¦  «        �rd„ |j        j        D ¦   «         }d|v}d|v}|rd|j        _        d|j        _        n3|rd|j        _        d|j        _        nd|j        _        d|j        _        d„ |j        j	        j        D ¦   «         }	d|	v}
d|	v}d„ |j        j	        j        D ¦   «         }d|v }|
rD|j        j	         
                    ¦   «         s$d|j        j	        _        d|j        j	        _        dS dS d|j        j	        _        |p| |j        j	        _        dS dS )	z’
        toggle the applied flag of the specified item.  if no item is specified,
        toggle the flag of the currently selected item.
        NFTc                 ó   — g | ]	}|j         ‘Œ
S r   rØ   ©rL   rã   s     r   rN   z3curseschunkselector.toggleapply.<locals>.<listcomp>˜  s   € Ð#MÐ#MÐ#M°C C¤KÐ#MÐ#MÐ#Mr   c                 ó   — g | ]	}|j         ‘Œ
S r   ©rQ   rW  s     r   rN   z3curseschunkselector.toggleapply.<locals>.<listcomp>œ  s   € Ð$NÐ$NÐ$N°S S¤[Ð$NÐ$NÐ$Nr   c                 ó   — g | ]	}|j         ‘Œ
S r   rØ   )rL   Úlns     r   rN   z3curseschunkselector.toggleapply.<locals>.<listcomp>­  s   € Ð#PÐ#PÐ#P°2 B¤JÐ#PÐ#PÐ#Pr   c                 ó   — g | ]	}|j         ‘Œ
S r   rØ   rW  s     r   rN   z3curseschunkselector.toggleapply.<locals>.<listcomp>¼  ó'   € ð %ð %ð %Ø #�”ð%ð %ð %r   c                 ó   — g | ]	}|j         ‘Œ
S r   rY  rW  s     r   rN   z3curseschunkselector.toggleapply.<locals>.<listcomp>Â  r]  r   )r  r   rP   rÒ   rG   rQ   rS   r~   rK   rD   rÚ   rw   r{   )r%   r9   rã   ÚhunklineÚsiblingappliedstatusÚallsiblingsappliedÚnosiblingsappliedÚsiblingspartialstatusÚsomesiblingspartialÚparentsiblingsappliedÚnoparentsiblingsappliedÚallparentsiblingsappliedÚparentsiblingspartialÚsomeparentsiblingspartials                 r   Útoggleapplyzcurseschunkselector.toggleapplyu  sk  € ð
 ˆ<ØÔ+ˆDà#'ˆDÔ àœ<Ð'ˆŒå�d�HÑ%Ô%ð P	Ø ˆDŒLØŒ|ð 1àœ:ð 0ð 0�CØ"&�C”Kà$'Ô$4ð 0ð 0˜Ø+/˜Ô(Ð(ð0ð0ð 0ð  œ:ð 1ð 1�CØ"'�C”KØ"'�C”Kà$'Ô$4ð 1ð 1˜Ø+0˜Ô(Ð(ð1ð	1ð 1õ ˜�fÑ%Ô%ð ?	Ø ˆDŒLà Ô-ð 0ð 0�Ø#'¤<�Ô Ð à#MÐ#M¸4¼;Ô;LÐ#MÑ#MÔ#MÐ Ø&+Ð/CÐ&CÐØ%)Ð-AÐ%AÐà$NÐ$N¸D¼KÔ<MÐ$NÑ$NÔ$NÐ!Ø"&Ð*?Ð"?Ðð
 !ð Ø”{×*Ò*Ñ,Ô,ð 0Ø*/�D”KÔ'Ø*/�D”KÔ'Ð'Ð'ð0ð 0ð '+�”Ô#à'ÐAÐ/AÐ+Að ”Ô#Ð#Ð#õ ˜�jÑ)Ô)ñ %	Ø#PÐ#P¸¼Ô9OÐ#PÑ#PÔ#PÐ Ø&+Ð/CÐ&CÐØ%)Ð-AÐ%AÐð !ð )Ø$)�”	Ô!Ø$)�”	Ô!Ð!Ø#ð )Ø$(�”	Ô!Ø$)�”	Ô!Ð!à$(�”	Ô!Ø$(�”	Ô!ð%ð %Ø'+¤yÔ'7Ô'=ð%ñ %ô %Ð!ð ,0Ð3HÐ+HÐ#Ø,1Ð5JÐ,JÐ$ð%ð %Ø'+¤yÔ'7Ô'=ð%ñ %ô %Ð!ð )-Ð0EÐ(EÐ%ð 'ð 	Ø”yÔ'×/Ò/Ñ1Ô1ð 5Ø/4�D”IÔ$Ô,Ø/4�D”IÔ$Ô,Ð,Ð,ð5ð 5ð
 ,0�”	Ô Ô(à-ÐMÐ5MÐ1Mð ”	Ô Ô(Ð(Ð(ðG%	ð %	r   c                 óÈ   — | j         r'| j        D ]}|j        r|                      |¦  «         Œn&| j        D ]}|j        s|                      |¦  «         Œ| j          | _         dS )z%toggle the applied flag of all items.N)r+  rC   rP   rj  )r%   r9   s     r   Ú	toggleallzcurseschunkselector.toggleallÓ  sˆ   € àÔ'ð 	+Øœð +ð +�Ø”<ð +Ø×$Ò$ TÑ*Ô*Ð*øð+ð œð +ð +�Ø”|ð +Ø×$Ò$ TÑ*Ô*Ð*øØ+/Ô+GÐ'GˆÔ$Ð$Ð$r   c                 ó    — | j         D ]E}|                     ¦   «         D ].}|                     ¦   «         D ]}|                      |¦  «         ŒŒ/ŒFdS )z`
        Flip all selections. Every selected line is unselected and vice
        versa.
        N)rC   r+   rj  )r%   rD   r{   r�   s       r   Úflipselectionsz"curseschunkselector.flipselectionsß  sv   € ð
 ”oð 	+ð 	+ˆFØ×*Ò*Ñ,Ô,ð +ð +�Ø ×,Ò,Ñ.Ô.ð +ð +�DØ×$Ò$ TÑ*Ô*Ð*Ð*ð+ð+ð	+ð 	+r   c                 óú  — | j         r| j        | j         k    r|                      ¦   «          dS | j         }| j        }dD ]B}|                     ¦   «         }|r"||k    r|                     ¦   «         }|r||k    °|r n||}}ŒC|sdS |}| j        j         }||                     ¦   «         k    rO|j        |k    r|                      |¬¦  «         |                     ¦   «         }||                     ¦   «         k    °MdS dS )zOtoggle applied on or off for all items in range [lastapplied,
        current].N)s   forwards   reverserE  )r   r  rj  r8   rP   )r%   Ú	startitemÚenditemÚ	directionr8   Údesiredstates         r   Útoggleallbetweenz$curseschunkselector.toggleallbetweené  sN  € ð Ô$ð	àÔ'¨4Ô+?Ò?Ð?ð ×ÒÑÔÐØˆFàÔ(ˆ	ØÔ*ˆà1ð 	4ð 	4ˆIØ ×)Ò)Ñ+Ô+ˆHØð /˜x¨7Ò2Ð2Ø#×,Ò,Ñ.Ô.�ð ð /˜x¨7Ò2Ð2àð Ø�à!(¨)�wˆIˆIàð 	ð ˆFàˆð  Ô3Ô;Ð;ˆØ˜'×*Ò*Ñ,Ô,Ò,Ð,ØÔ <Ò/Ð/Ø× Ò  hÐ Ñ/Ô/Ð/Ø×(Ò(Ñ*Ô*ˆHð ˜'×*Ò*Ñ,Ô,Ò,Ð,Ð,Ð,Ð,Ð,r   c                 óš  — |€| j         }|st          |t          ¦  «        r|j        rxt          |t          ¦  «        s|                     ¦   «         x| _         }n|j        rd|_        t          |t          ¦  «        r$|                     ¦   «         D ]}|j         |_        Œt          |t          t          f¦  «        r|j         |_        dS dS )zMtoggle folded flag of specified item (defaults to currently
        selected)NF)r  rÒ   rG   rR   r2   r+   r4   rK   )r%   r9   Ú
foldparentÚchilds       r   r>  z curseschunkselector.togglefolded  sÞ   € ð ˆ<ØÔ+ˆDØð 
	3�* T­8Ñ4Ô4ð 
	3¸Ô9Kð 
	3Ý˜d¥HÑ-Ô-ð +à26·/²/Ñ2CÔ2CÐC�Ô(¨4¨4ØÔ#ð +Ø%*�Ô"õ ˜$¥Ñ)Ô)ð 3Ø!×-Ò-Ñ/Ô/ð 3ð 3�EØ'+¤{ ?�E”L�Lå�d�X¥vÐ.Ñ/Ô/ð 	*Ø"œk˜/ˆDŒKˆKˆKð	*ð 	*r   c                 ó¶   — |                      ¦   «         \  }}| j        }|                     d¦  «        }t          j        |¦  «        }|||z   |z  z
  }|d|z  z   S )zý
        add whitespace to the end of a string in order to make it fill
        the screen in the x direction.  the current cursor position is
        taken into account when making this calculation.  the string can span
        multiple lines.
        é   rª   )ÚgetyxÚxscreensizeÚ
expandtabsr   Úcolwidth)r%   ÚinstrÚwindowÚyÚxstartÚwidthÚstrwidthÚ	numspacess           r   Úalignstringzcurseschunkselector.alignstring'  sd   € ð —L’L‘N”N‰	ˆˆ6ØÔ ˆà× Ò  Ñ#Ô#ˆÝÔ$ UÑ+Ô+ˆØ˜h¨Ñ/°5Ñ8Ñ9ˆ	Ø�t˜iÑ'Ñ'Ð'r   Tc                 ó&  — |                      d¦  «        }t          j        dd„ |                     d¦  «        ¦  «        }|�|}nI|�| j        |         }n9|€d}|€d}||f| j        v r| j        ||f         }n|                      ||¦  «        }|€g }|dk     r|D ]}||z  }Œn$t          j        t          j	        fD ]}||v r||z  }Œ| j
                             ¦   «         \  }}d}|
r8t          |¦  «        }|                     d	¦  «        }t          |¦  «        }||z
  }|r(|                     t          j        |¦  «        |¦  «         ||z  }|
rK|t          j        z  }|r2t%          |¦  «        D ]"}|                     t          j        |¦  «         Œ#|d
|z  z  }|	rJ|r-|                      d|¦  «        }|                     ||¦  «         n|                      ||¦  «        }||z  }|t          |¦  «        z   | j        z  }| xj        |z  c_        |S )a  
        print the string, text, with the specified colors and attributes, to
        the specified curses window object.

        the foreground and background colors are of the form
        curses.color_xxxx, where xxxx is one of: [black, blue, cyan, green,
        magenta, red, white, yellow].  if pairname is provided, a color
        pair will be looked up in the self.colorpairnames dictionary.

        attrlist is a list containing text attributes in the form of
        curses.a_xxxx, where xxxx can be: [bold, dim, normal, standout,
        underline].

        if align == True, whitespace is added to the printed string such that
        the string stretches to the right border of the window.

        if showwhtspc == True, trailing whitespace of a string is highlighted.
        ry  s   [\x00-\x08\x0a-\x1f]c           	      óŽ   — dt          j        t          t          |                      ¦   «         ¦  «        dz   ¦  «        ¦  «        z   S )Nó   ^é@   )r   ÚsysbytesÚchrÚordÚgroup©Úms    r   r=  z1curseschunkselector.printstring.<locals>.<lambda>Z  s1   € �d�XÔ.­sµ3°q·w²w±y´y±>´>ÀBÑ3FÑ/GÔ/GÑHÔHÑH€ r   ó   
Nro   é   r   s    
rª   )r|  ÚreÚsubÚstripr  r  Úgetcolorpairr   ÚA_UNDERLINEÚA_BOLDÚchunkpadrz  r_   r  Úaddstrr   ÚstrfromlocalÚ	A_REVERSEÚrangeÚaddchÚACS_CKBOARDr…  r{  r)  )r%   r  rÉ   ÚfgcolorÚbgcolorÚpairÚpairnameÚattrlistÚtowinÚalignÚ
showwhtspcÚ	colorpairÚtextattrr€  r�  ÚtÚoriglenÚstrippedlenÚnumtrailingspacesÚwscolorpairÚiÚextrawhitespaceÚlinesprinteds                          r   Úprintstringzcurseschunkselector.printstring6  sŽ  € ð@ �Š˜qÑ!Ô!ˆåŒvØ$ØHÐHØ�JŠJ�uÑÔñ
ô 
ˆð ÐØˆIˆIØÐ!ØÔ+¨HÔ5ˆIˆIàˆØ�ØˆØ�Ø˜Ð! T¤_Ð4Ð4Ø œO¨W°gÐ,>Ô?�	�	à ×-Ò-¨g°wÑ?Ô?�	àÐØˆHØ�sŠ?ˆ?à$ð &ð &�Ø˜XÑ%�	�	ð&õ $Ô/µ´Ð?ð *ð *�Ø˜xÐ'Ð'Ø Ñ)�Iøà”M×'Ò'Ñ)Ô)‰	ˆˆ6Øˆàð 	6Ý˜$‘i”iˆGØ—;’;˜vÑ&Ô&ˆDÝ˜d™)œ)ˆKØ '¨+Ñ 5Ðàð 	BØ�MŠM�(Ô/°Ñ5Ô5°yÑAÔAÐAØ	ˆT‰	ˆàð 	*Ø#¥fÔ&6Ñ6ˆKØð BÝÐ0Ñ1Ô1ð Bð B�AØ—L’L¥Ô!3°[ÑAÔAÐAÐAØ�Ð)Ñ)Ñ)ˆAàð 	!Øð >Ø"&×"2Ò"2°3¸Ñ"?Ô"?�Ø—’˜o¨yÑ9Ô9Ð9Ð9ð #'×"2Ò"2°1°fÑ"=Ô"=�Ø�Ñ ˆAð ¥ Q¡¤™¨DÔ,<Ñ<ˆØÐ#Ô# |Ñ3Ð#Ô#Øˆr   c           
      óz  — | j         j        }t          d¦  «        }t          d¦  «        }t          t	          |¦  «        t	          |¦  «        ¦  «        }d||r|n|fz  }t
          | j                 dt          d¦  «        t          d¦  «        t          d¦  «        t          d¦  «        |t          d	¦  «        g}|S )
z-> [str]. return segmentss   space/enter: selects   space/enter: deselects   %-*sr¥   s   [x]=selected **=collapseds
   c: confirms   q: aborts    arrow keys: move/expand/collapses   ?: help)r  rP   r   Úmaxr_   r,  rÖ   )r%   ÚselectedÚspaceselectÚspacedeselectÚspacelenÚselectedlabelÚsegmentss          r   Ú_getstatuslinesegmentsz*curseschunkselector._getstatuslinesegments›  s½   € àÔ+Ô3ˆÝÐ.Ñ/Ô/ˆÝÐ2Ñ3Ô3ˆõ •s˜;Ñ'Ô'­¨]Ñ);Ô);Ñ<Ô<ˆØØØ%Ð6ˆMˆM¨;ð#
ñ 
ˆõ
 ˜DœNÔ+ØÝÐ*Ñ+Ô+ÝˆmÑÔÝˆk‰NŒNÝÐ1Ñ2Ô2ØÝˆj‰MŒMð	
ˆð ˆr   c                 óD  ‡ — ‰ j         �‰ j         t          d¦  «        g}n£‰                      ¦   «         }‰ j        }g }|}|D ]�}t	          j        |¦  «        }dd|o	|d         dvz   z  }||z   t          |¦  «        z   |k    r|                     |¦  «         |}ŒY|dxx         ||z   z  cc<   ||t          |¦  «        z   z  }Œ‚t          |¦  «        ‰ j        k    r9t          |¦  «        ‰ _        ‰ j	         
                    ‰ j        ‰ j        ¦  «         ˆ fd„|D ¦   «         S )	z<() -> [str]. return short help used in the top status windowNs   Press any key to continuerª   r   r   s   -[ro   c                 óJ   •— g | ]}t          j        |‰j        d z
  ¦  «        ‘Œ S )r   )r   Úellipsisr{  )rL   r¢   r%   s     €r   rN   z7curseschunkselector._getstatuslines.<locals>.<listcomp>É  s.   ø€ ÐLÐLÐLÀ•
Ô# A tÔ'7¸!Ñ';Ñ<Ô<ÐLÐLÐLr   )r  r   rº  r{  r   r}  r_   rº   r(  Ú	statuswinÚresize)r%   Úlinesr¹  r‚  Ú	lastwidthÚsÚwÚseps   `       r   Ú_getstatuslinesz#curseschunkselector._getstatuslines³  s=  ø€ àŒ=Ð$Ø”]¥AÐ&BÑ$CÔ$CÐDˆEˆEð ×2Ò2Ñ4Ô4ˆHØÔ$ˆEØˆEØˆIØð .ð .�ÝÔ% aÑ(Ô(�Ø˜a 1Ð#:¨¨1¬°UÐ):Ñ;Ñ<�Ø˜q‘=¥3 s¡8¤8Ñ+¨uÒ4Ð4Ø—L’L ‘O”O�OØ !�I�Ià˜"�I�I”I  q¡Ñ(�I�I‘IØ ¥S¨¡X¤X¡Ñ-�I�IÝˆu‰:Œ:˜Ô,Ò,Ð,Ý"% e¡*¤*ˆDÔØŒN×!Ò! $Ô"5°tÔ7GÑHÔHÐHØLÐLÐLÐLÀeÐLÑLÔLÐLr   c           	      ó8  — | j                              ¦   «          | j                             ¦   «          | j        }	 |                      ¦   «         D ]} || j         |d¬¦  «         Œ| j                              ¦   «          n# t          j        $ r Y nw xY w| j        �d S 	 |  	                    ¦   «          |  
                    ¦   «          | j                             | j        d| j        d| j        | j        z
  | j        dz
  ¦  «         d S # t          j        $ r Y d S w xY w)Nó   legend©r¢  r   r   )r¾  Úeraser˜  r±  rÅ  r  r   r	   r  Ú	printitemrR  r&  r(  rJ  r{  )r%   r±  r�   s      r   Úupdatescreenz curseschunkselector.updatescreenË  sR  € ØŒ×ÒÑÔÐØŒ×ÒÑÔÐàÔ&ˆð	Ø×,Ò,Ñ.Ô.ð Fð F�Ø�˜DœN¨D¸9ÐEÑEÔEÐEÐEØŒN×"Ò"Ñ$Ô$Ð$Ð$øÝŒ|ð 	ð 	ð 	ØˆDð	øøøàŒ=Ð$ØˆFð	Ø�NŠNÑÔÐØ×ÒÑÔÐØŒM×!Ò!ØÔ*ØØÔ#ØØÔ  4Ô#6Ñ6ØÔ  1Ñ$ñô ð ð ð øõ Œ|ð 	ð 	ð 	ØˆDˆDð	øøøs%   »AA? Á?BÂBÂA&D ÄDÄDc                 ó*  — |j         r"t          |t          ¦  «        s
|j        rd}nd}nd}	 |j        r*|dz  }t          |t
          ¦  «        r|j        }||dz   z  }n|dz  }t          |t
          ¦  «        r|dz  }n# t          $ r |dz  }Y nw xY w|S )zx
        create a string to prefix a line with which indicates whether 'item'
        is applied and/or folded.
        s   [~]s   [x]s   [ ]s   **rª   s     )rP   rÒ   rw   rQ   r4   rG   Ú
changetyper5   )r%   r9   ÚcheckboxÚ
filestatuss       r   Úgetstatusprefixstringz)curseschunkselector.getstatusprefixstringê  sÕ   € ð Œ<ð 	Ý˜d¥JÑ/Ô/ð "°D´Lð "Ø!��à!��àˆHð	ØŒ{ð &Ø˜EÑ!�Ý˜d¥HÑ-Ô-ð 2à!%¤�Jà 
¨TÑ 1Ñ1�Høà˜EÑ!�Ý˜d¥HÑ-Ô-ð &à Ñ%�HøøÝð 	ð 	ð 	Ø˜ÑˆHˆHˆHð	øøøð ˆs   ­AA> Á>BÂBc                 óÔ  — d}|                      ¦   «         }| j                             |¦  «        }|dk    r0|j        s)||                      | j        d| j        z  |d¬¦  «        z  }|                      |rdpdt          j	        g¬¦  «        }d}	|  
                    |¦  «        }
|j        r|r!|                     d	¦  «        }|
|d         z   }n|
|                     ¦   «         z   }||                      | j        |||¬
¦  «        z  }|j        r|rYt          |¦  «        dk    rF|dd…         D ];}d|	t          |
¦  «        z   z  |z   }||                      | j        |||¬
¦  «        z  }Œ<|S )zŸ
        print the header to the pad.  if countlines is True, don't print
        anything, but just count the number of lines which would be printed.
        r   r   ó   _F©r¤  r¥  ó   selectedó   normal©rt   r£  r�  ©r¡  r¤  r   Nrª   )r[   r  r`   r4   r±  r˜  r{  r•  r   r—  rÐ  ÚsplitrÍ   r_   )r%   rD   r´  r¤  ÚignorefoldingÚoutstrrÉ   Ú
chunkindexr§  ÚindentnumcharsrÎ  ÚtextlistÚlinestrr�   s                 r   Úprintheaderzcurseschunkselector.printheader  s·  € ð ˆØ×ÒÑ!Ô!ˆØ”^×)Ò)¨&Ñ1Ô1ˆ
à˜Š?ˆ? 6¤=ˆ?à�d×&Ò&Ø”˜t dÔ&6Ñ6¸eÈ5ð 'ñ ô ñ ˆFð ×%Ò%ØÐ)˜kÐ6¨YÅ&Ä-Àð &ñ 
ô 
ˆ	ð ˆØ×-Ò-¨fÑ5Ô5ˆØŒ}ð 	3 ð 	3Ø—z’z %Ñ(Ô(ˆHØ ¨!¤Ñ,ˆGˆGà §¢Ñ!2Ô!2Ñ2ˆGØ�$×"Ò"ØŒM˜7¨¸%ð #ñ 
ô 
ñ 	
ˆð Œ}ð 	 ð 	Ý�8‰}Œ}˜qÒ Ð Ø$ Q R RœLð ð �DØ" nµs¸8±}´}Ñ&DÑEÈÑL�GØ˜d×.Ò.Øœ w°YÀeð /ñ ô ñ �F�Fð ˆr   c                 ó²  — d}|j         j                             |¦  «        }|dk    r)||                      | j        d| j        z  |d¬¦  «        z  }|                      |rdpdt          j        g¬¦  «        }|  	                    |¦  «        }d| j
        z  |z   }	d	|                     ¦   «                              d
¦  «        z   }
||                      | j        |	|d¬¦  «        z  }||                      | j        |
||¬¦  «        z  }|j        r|s|S |j        D ]?}d| j        t!          |¦  «        z   z  |z   }||                      | j        ||¬¦  «        z  }Œ@|S )z!includes start/end line indicatorr   r   rª   FrÓ  rÔ  rÕ  rÖ  s      r�  r×  ©r¤  )rD   rS   r`   r±  r˜  r{  r•  r   r—  rÐ  r$  r·   r”  r4   r«   r%  r_   )r%   r{   r´  r¤  rÙ  rÚ  Ú	hunkindexr§  rÎ  Ú
lineprefixÚfrtoliner�   rÞ  s                r   Úprinthunklinesbeforez(curseschunkselector.printhunklinesbefore8  s©  € ð ˆà”KÔ%×+Ò+¨DÑ1Ô1ˆ	à˜Š>ˆ>à�d×&Ò&Ø”˜t dÔ&6Ñ6¸eÈ5ð 'ñ ô ñ ˆFð ×%Ò%ØÐ)˜kÐ6¨YÅ&Ä-Àð &ñ 
ô 
ˆ	ð
 ×-Ò-¨dÑ3Ô3ˆà˜DÔ3Ñ3°hÑ>ˆ
Ø˜D×.Ò.Ñ0Ô0×6Ò6°uÑ=Ô=Ñ=ˆà�$×"Ò"ØŒM˜:¨U¸%ð #ñ 
ô 
ñ 	
ˆð 	�$×"Ò"ØŒM˜8¨)¸5ð #ñ 
ô 
ñ 	
ˆð Œ;ð 	˜}ð 	àˆMð ”Kð 	Lð 	LˆDà˜Ô3µc¸(±m´mÑCÑDÀtÑKð ð �d×&Ò& t¤}°gÀUÐ&ÑKÔKÑKˆFˆFàˆr   c                 óØ   — d}|j         r|s|S |                      |¦  «        }|j        D ]?}d| j        t	          |¦  «        z   z  |z   }||                      | j        ||¬¦  «        z  }Œ@|S )Nr   rª   rá  )r4   rÐ  r¬   r%  r_   r±  r˜  )r%   r{   r¤  rÙ  rÚ  rÎ  r�   rÞ  s           r   Úprinthunklinesafterz'curseschunkselector.printhunklinesafterd  s�   € ØˆØŒ;ð 	˜}ð 	ØˆMð ×-Ò-¨dÑ3Ô3ˆØ”Jð 	Lð 	LˆDà˜Ô3µc¸(±m´mÑCÑDÀtÑKð ð �d×&Ò& t¤}°gÀUÐ&ÑKÔKÑKˆFˆFàˆr   c                 óZ  — d}|                       |¦  «        }|                     ¦   «                              d¦  «        }|r|                      d¬¦  «        }nƒ|                     d¦  «        r|                      d¬¦  «        }nW|                     d¦  «        r|                      d¬¦  «        }n+|                     d	¦  «        r|                      d
¬¦  «        }d| j        z  |z   }||                      | j        ||d¬¦  «        z  }||                      | j        |||d¬¦  «        z  }|S )Nr   r�  rÔ  ©rt   rž   ó   additionr¥   ó   deletionó   \rÕ  rª   FrÓ  T)r¡  r¤  r¦  )rÐ  r[   r”  r•  r    r%  r±  r˜  )	r%   r_  r´  r¤  rÚ  rÎ  rÞ  r§  rã  s	            r   Úprinthunkchangedlinez(curseschunkselector.printhunkchangedlines  sX  € ØˆØ×-Ò-¨hÑ7Ô7ˆà×$Ò$Ñ&Ô&×,Ò,¨UÑ3Ô3ˆð ð 	:Ø×)Ò)¨{Ð)Ñ;Ô;ˆIˆIØ×Ò Ñ%Ô%ð 	:Ø×)Ò)¨{Ð)Ñ;Ô;ˆIˆIØ×Ò Ñ%Ô%ð 	:Ø×)Ò)¨{Ð)Ñ;Ô;ˆIˆIØ×Ò Ñ&Ô&ð 	:Ø×)Ò)¨yÐ)Ñ9Ô9ˆIà˜DÔ7Ñ7¸(ÑBˆ
Ø�$×"Ò"ØŒM˜:¨U¸%ð #ñ 
ô 
ñ 	
ˆð 	�$×"Ò"ØŒM˜7¨¸%ÈDð #ñ 
ô 
ñ 	
ˆð ˆr   c                 óˆ   — |€| j         }|rd| _        g }|                      |||||¬¦  «         d                     |¦  «        S )zÑ
        use __printitem() to print the the specified item.applied.
        if item is not specified, then print the entire patch.
        (hiding folded elements, etc. -- see __printitem() docstring)
        Nr   rá  r   )rC   r)  Ú_curseschunkselector__printitemr»   )r%   r9   rÙ  Úrecursechildrenr¤  rÚ  s         r   rÊ  zcurseschunkselector.printitemŒ  sa   € ð ˆ<Ø”?ˆDØð 	,Ø*+ˆDÔ'àˆØ×ÒØ�- °&Àð 	ñ 	
ô 	
ð 	
ð �xŠx˜ÑÔÐr   c                 ó°   — | j                              ¦   «         \  }}t          d| j        | j        z
  ¦  «        }| j        | j        dz  z   }||k     p||k    S )Nr   é   )r˜  rz  Úminr&  rJ  )r%   r€  r   ÚminyÚmaxys        r   Úoutofdisplayedareaz&curseschunkselector.outofdisplayedarea   s]   € ØŒ}×"Ò"Ñ$Ô$‰ˆˆ1õ �1�dÔ0°4Ô3CÑCÑDÔDˆØÔ)¨DÔ,<¸qÑ,@Ñ@ˆØ�4ŠxÐ#˜1˜tš8Ð#r   c                 óŠ   — || j         u }|r7|r5| j        | _        |                      |d¬¦  «        }| j        |z   dz
  | _        |S )NF©rð  r   )r  r)  r!  Úgetnumlinesdisplayedr"  )r%   r9   rð  r´  Úselecteditemliness        r   Úhandleselectionz#curseschunkselector.handleselection©  sk   € Ø˜4Ô3Ð3ˆØð 	˜ð 	à)-Ô)DˆDÔ&Ø $× 9Ò 9Ø eð !:ñ !ô !Ðð Ô*Ð->Ñ>ÀÑBð Ô$ð ˆr   c                 óv  — |r|                       ¦   «         rdS |                      ||¦  «        }t          |t          ¦  «        r |r|D ]}|                      |||||¦  «         Œt          |t
          ¦  «        rR|                     |                      ||||¬¦  «        ¦  «         |r#|j        D ]}|                      |||||¦  «         Œnît          |t          ¦  «        r‹|j
        j        r|r}|                     |                      ||||¬¦  «        ¦  «         |rN|j        D ]}	|                      |	||||¦  «         Œ|                     |                      |||¬¦  «        ¦  «         nNt          |t          ¦  «        r9|j        j        r|r+|                     |                      |||¬¦  «        ¦  «         |S )a{  
        recursive method for printing out patch/header/hunk/hunk-line data to
        screen.  also returns a string with all of the content of the displayed
        patch (not including coloring, etc.).

        if ignorefolding is True, then folded items are printed out.

        if recursechildren is False, then only print the item without its
        child items.
        N)r¤  rÙ  rá  )rö  rû  rÒ   r
   rï  rG   rº   rß  rS   rK   rD   r4   rå  r~   rç  rw   r{   rí  )
r%   r9   rÙ  rð  rÚ  r¤  r´  rá   rã   r¢   s
             r   Ú__printitemzcurseschunkselector.__printitem¶  sY  € ð ð 	�T×,Ò,Ñ.Ô.ð 	ØˆFà×'Ò'¨¨oÑ>Ô>ˆõ �d�EÑ"Ô"ð 	Øð Øð ð �CØ×$Ò$Ø˜]¨O¸VÀUñô ð ð õ �d�HÑ%Ô%ð #	Ø�MŠMØ× Ò Ø˜(¨%¸}ð !ñ ô ñô ð ð
 ð Øœ:ð ð �CØ×$Ò$Ø˜]¨O¸VÀUñô ð ð øõ ˜�fÑ%Ô%ð 	Ø”Ô#ð	Ø(5ð	ð �MŠMØ×)Ò)Ø˜(¨%¸}ð *ñ ô ñô ð ð
 ð 	ØÔ*ð ð �AØ×$Ò$Ø˜=¨/¸6À5ñô ð ð ð —’Ø×,Ò,Ø E¸ð -ñ ô ñô ð øõ
 ˜�jÑ)Ô)ð 	Ø”Ô!ð	Ø&3ð	ð �MŠMØ×)Ò)¨$°ÀÐ)ÑFÔFñô ð ð ˆr   c                 óf   — |                       |||d¬¦  «        }t          |¦  «        | j        z  }|S )aY  
        return the number of lines which would be displayed if the item were
        to be printed to the display.  the item will not be printed to the
        display (pad).
        if no item is given, assume the entire patch.
        if ignorefolding is True, folded items will be unfolded when counting
        the number of lines.
        Frá  )rÊ  r_   r{  )r%   r9   rÙ  rð  ÚpatchdisplaystringrT  s         r   rù  z(curseschunkselector.getnumlinesdisplayedø  sC   € ð "Ÿ^š^Ø�- ¸ð ,ñ 
ô 
Ðõ Ð)Ñ*Ô*¨dÔ.>Ñ>ˆØˆr   c                 ót  — 	 t          j        ¦   «          t          j        | j        ¦  «        \  | _        | _        | j                             | j	        | j        ¦  «         |  
                    d¬¦  «        dz   | _        t          j        | j        | j        ¦  «        | _        dS # t           j        $ r Y dS w xY w)zhandle window resizingT©rÙ  r   N)r   Úendwinr   Útermsizer   r{  rJ  r¾  r¿  r(  rù  r'  Únewpadr˜  r	   )r%   ÚnÚframes      r   Úsigwinchhandlerz#curseschunkselector.sigwinchhandler  s¬   € ð	ÝŒM‰OŒOˆOÝ18Ô1AÀ$Ä'Ñ1JÔ1JÑ.ˆDÔ˜dÔ.ØŒN×!Ò! $Ô"5°tÔ7GÑHÔHÐHØ#×8Ò8ÀtÐ8ÑLÔLÈqÑPˆDÔÝ"œM¨$Ô*:¸DÔ<LÑMÔMˆDŒMˆMˆMøÝŒ|ð 	ð 	ð 	ØˆDˆDð	øøøs   ‚B B$ Â$B7Â6B7c                 ó2  — |�|| j         v r| j         |         }nÄ|€d}|€d}||f| j        v r| j        ||f         }n¡t          | j        ¦  «        dz   }| j        rUt	          j        |||¦  «         t	          j        |¦  «        x}| j        ||f<   |�t	          j        |¦  «        | j         |<   n.d}|�|dk    rt          j        }|| j         |<   |x}| j        ||f<   |€g }|dk     r|D ]}||z  }Œn$t          j        t          j	        fD ]}	|	|v r||	z  }Œ|S )a„  
        get a curses color pair, adding it to self.colorpairs if it is not
        already defined.  an optional string, name, can be passed as a shortcut
        for referring to the color-pair.  by default, if no arguments are
        specified, the white foreground / black background color-pair is
        returned.

        it is expected that this function will be used exclusively for
        initializing color pairs, and not curses.init_pair().

        attrlist is used to 'flavor' the returned color-pair.  this information
        is not stored in self.colorpairs.  it contains attribute values like
        curses.A_BOLD.
        Nro   r   r   rÔ  r‘  )
r  r  r_   r  r   Ú	init_pairÚ
color_pairr›  r–  r—  )
r%   rŸ  r   rt   r£  r§  Ú	pairindexÚcvalr¨  Ú
textattribs
             r   r•  z curseschunkselector.getcolorpair  sŠ  € ð$ Ð $¨$Ô*=Ð"=Ð"=àÔ+¨DÔ1ˆIˆIàˆØ�ØˆØ�Ø˜Ð! T¤_Ð4Ð4Ø œO¨W°gÐ,>Ô?�	�	å ¤Ñ0Ô0°1Ñ4�	Ø”=ð KÝÔ$ Y°¸ÑAÔAÐAõ Ô)¨)Ñ4Ô4ð5�I ¤Ø  'Ð*ñ!ð Ð'Ý4:Ô4EÀiÑ4PÔ4P˜Ô+¨DÑ1øà�DØÐ'Ø ;Ò.Ð.Ý#)Ô#3˜DØ48˜Ô+¨DÑ1ØFJÐJ�I ¤°¸'Ð0BÑ Cð ÐØˆHØ�sŠ?ˆ?à$ð &ð &�Ø˜XÑ%�	�	ð&õ  &Ô1µ6´=ÐAð ,ð ,�
Ø Ð)Ð)Ø Ñ+�IøØÐr   c                 ó    —  | j         |i |¤Ž dS )zsame as getcolorpair.N)r•  )r%   rõ   rö   s      r   Úinitcolorpairz!curseschunkselector.initcolorpairQ  s    € àˆÔ˜4Ð* 6Ð*Ð*Ð*Ð*Ð*r   c                 ó$  — t          d¦  «        }t          j        | j        ddd¦  «        }|                     d¦  «        }|dg| j        | j        z
  t          |¦  «        z
  dz
  z  z   }	 |D ]}|                      ||d¬¦  «         Œn# t          j        $ r Y nw xY w| 	                    ¦   «          	 | j
                             d¦  «        5  |                     ¦   «          d	d	d	¦  «         d	S # 1 swxY w Y   d	S # t          j        $ r Y d	S w xY w)
z<print a help window to the screen.  exit after any keypress.s              [press any key to return to the patch-display]

The curses hunk selector allows you to interactively choose among the
changes you have made, and confirm only those changes you select for
further processing by the command you are running (such as commit,
shelve, or revert). After confirming the selected changes, the
unselected changes are still present in your working copy, so you can
use the hunk selector multiple times to split large changes into
smaller changesets. the following are valid keystrokes:

              x [space] : (un-)select item ([~]/[x] = partly/fully applied)
                [enter] : (un-)select item and go to next item of same type
                      A : (un-)select all items
                      X : (un-)select all items between current and most-recent
    up/down-arrow [k/j] : go to previous/next unfolded item
        pgup/pgdn [K/J] : go to previous/next item of same type
 right/left-arrow [l/h] : go to child item / parent item
 shift-left-arrow   [H] : go to parent header / fold selected header
                      g : go to the top
                      G : go to the bottom
                      f : fold / unfold item, hiding/revealing its children
                      F : fold / unfold parent item and all of its ancestors
                 ctrl-l : scroll the selected line to the top of the screen
                      m : edit / resume editing the commit message
                      e : edit the currently selected hunk
                      a : toggle all selections
                      c : confirm selected changes
                      r : review/edit and confirm selected changes
                      q : quit without confirming (no changes will be made)
                      ? : help (what you're currently reading)r   r�  rª   r   rÇ  rÈ  ó   crecordN)r   r   ÚnewwinrJ  rØ  r(  r_   r±  r	   r  r   ÚtimeblockedsectionÚgetkey)r%   ÚhelptextÚhelpwinÚ	helplinesr�   s        r   Ú
helpwindowzcurseschunkselector.helpwindowU  s“  € åðBñ
ô 
ˆõB ”- Ô 0°!°Q¸Ñ:Ô:ˆØ—N’N 5Ñ)Ô)ˆ	Ø  ØÔ˜tÔ2Ñ2µS¸±^´^ÑCÀaÑGñ!
ñ 
ˆ	ð	Ø!ð Dð D�Ø× Ò  ¨$¸Ð ÑCÔCÐCÐCðDøåŒ|ð 	ð 	ð 	ØˆDð	øøøà�ŠÑÔÐð	Ø”×+Ò+¨JÑ7Ô7ð !ð !Ø—’Ñ Ô Ð ð!ð !ð !ñ !ô !ð !ð !ð !ð !ð !ð !ð !øøøð !ð !ð !ð !ð !ð !øåŒ|ð 	ð 	ð 	ØˆDˆDð	øøøsH   Á+B	 Â	BÂBÂ3C< ÃC/Ã"C< Ã/C3Ã3C< Ã6C3Ã7C< Ã<DÄDc                 ó|  — t          j        ¦   «          t          j        ¦   «          t          j        ¦   «          | j                             | j        | j                             ¦   «         ¦  «        | _        t          j        ¦   «          | j	         
                    ¦   «          | j	                             d¦  «         dS )z?Create a temporary commit message editing window on the screen.r   N)r   ÚrawÚdef_prog_moder  r   Úeditr*  ÚusernameÚcbreakr
  r  Úkeypadr$   s    r   ÚcommitMessageWindowz'curseschunkselector.commitMessageWindow‰  s�   € õ 	Œ
‰ŒˆÝÔÑÔÐÝŒ‰ŒˆØœ7Ÿ<š<¨Ô(8¸$¼'×:JÒ:JÑ:LÔ:LÑMÔMˆÔÝŒ‰ŒˆØŒ×ÒÑÔÐØŒ×Ò˜1ÑÔÐÐÐr   c                 ó|   — | j         d         | _        | j        }	 |                     ¦   «         }|€n|}Œ|| _        dS )zT
        Handle 'g' to navigate to the top most file in the ncurses window.
        r   TN)rC   r  r2   r0  s      r   Úhandlefirstlineeventz(curseschunkselector.handlefirstlineevent”  sT   € ð $(¤?°1Ô#5ˆÔ ØÔ.ˆð	'Ø"×-Ò-Ñ/Ô/ˆHØÐØà&�ð	'ð $/ˆÔ Ð Ð r   c                 ó¬   — | j         }|                     ¦   «         }|�|                     ¦   «         }|€n|}|­|| _         |                      ¦   «          dS )aµ  
        Handle 'G' to navigate to the bottom most file/hunk/line depending
        on the whether the fold is active or not.

        If the bottom most file is folded, it navigates to that file and
        stops there. If the bottom most file is unfolded, it navigates to
        the bottom most hunk in that file and stops there. If the bottom most
        hunk is unfolded, it navigates to the bottom most line in that hunk.
        N)r  r8   r4  r0  s      r   Úhandlelastlineeventz'curseschunkselector.handlelastlineevent¤  sl   € ð Ô.ˆØ×'Ò'Ñ)Ô)ˆàÐ"Ø"×+Ò+Ñ-Ô-ˆHØÐØà&�ð Ð"ð $/ˆÔ Ø×"Ò"Ñ$Ô$Ð$Ð$Ð$r   c                 ó  — t          j        | j        ddd¦  «        }	 |                     d¦  «        }|D ]}|                      ||d¬¦  «         Œn# t           j        $ r Y nw xY w| j                             ¦   «          |                     ¦   «          	 | j         	                    d¦  «        5  t          | j                             ¦   «         ¦  «        }ddd¦  «         n# 1 swxY w Y   n# t          $ r d}Y nw xY w|S )zMdisplay an informational window, then wait for and return a
        keypress.r   r�  rÔ  rÈ  r  N)r   r  rJ  rØ  r±  r	   r
  r  r   r  r‹  ÚgetchÚ
ValueError)r%   Ú
windowtextÚ
confirmwinrÀ  r�   Úresponses         r   Úconfirmationwindowz&curseschunkselector.confirmationwindow»  sh  € õ ”] 4Ô#3°Q¸¸1Ñ=Ô=ˆ
ð	Ø×$Ò$ UÑ+Ô+ˆEØð Ið I�Ø× Ò  ¨T¸KÐ ÑHÔHÐHÐHðIøåŒ|ð 	ð 	ð 	ØˆDð	øøøàŒ×ÒÑÔÐØ×ÒÑÔÐð	Ø”×+Ò+¨JÑ7Ô7ð 4ð 4Ý˜tœ{×0Ò0Ñ2Ô2Ñ3Ô3�ð4ð 4ð 4ñ 4ô 4ð 4ð 4ð 4ð 4ð 4ð 4øøøð 4ð 4ð 4ð 4øøåð 	ð 	ð 	ØˆHˆHˆHð	øøøð ˆsG   ž2A ÁA#Á"A#ÂC- Â.'C!ÃC- Ã!C%Ã%C- Ã(C%Ã)C- Ã-C<Ã;C<c                 ó  — t          d¦  «        }| j                             d¦  «        5  |                      |¦  «        }ddd¦  «         n# 1 swxY w Y   |€d}|                     ¦   «                              d¦  «        rdS dS )zPask for 'y' to be pressed to confirm selected. return True if
        confirmed.sÈ  If you answer yes to the following, your currently chosen patch chunks
will be loaded into an editor. To modify the patch, make the changes in your
editor and save. To accept the current patch as-is, close the editor without
saving.

note: don't add/remove lines unless you also modify the range information.
      failing to follow this rule will result in the commit aborting.

are you sure you want to review/edit and confirm the selected changes [yn]?
r  Nr  r€  TF)r   r   r  r+  Úlowerr    )r%   Úconfirmtextr*  s      r   Úreviewcommitz curseschunkselector.reviewcommitÐ  sÍ   € õ ð	ñ
ô 
ˆð ŒW×'Ò'¨
Ñ3Ô3ð 	<ð 	<Ø×.Ò.¨{Ñ;Ô;ˆHð	<ð 	<ð 	<ñ 	<ô 	<ð 	<ð 	<ð 	<ð 	<ð 	<ð 	<øøøð 	<ð 	<ð 	<ð 	<àÐØˆHØ�>Š>ÑÔ×&Ò& sÑ+Ô+ð 	Ø�4à�5s   ªAÁAÁAc                 óZ   — |                       d¬¦  «         |                      ¦   «          dS )a  
        once we scrolled with pg up pg down we can be pointing outside of the
        display zone. we print the patch with towin=False to compute the
        location of the selected item even though it is outside of the displayed
        zone and then update the scroll.
        Frá  N)rÊ  rR  r$   s    r   r4  z)curseschunkselector.recenterdisplayedareaè  s0   € ð 	�Š˜UˆÑ#Ô#Ð#Ø×ÒÑÔÐÐÐr   c                 óÖ  ‡— d„ }d„ }|€| j         }t          |t          ¦  «        rdS t          |t          ¦  «        r|                     ¦   «         }t          |t
          ¦  «        sdS |                     ¦   «         j                             |¦  «        }|j        |j	        }} || |¦  «        }|€|s || ¦  «         dS |j
        Š‰j                             |¦  «        }	‰j        d|	…         }
‰j        |	dz   d…         }|d         }ˆfd„|j        D ¦   «         }t          d„ |D ¦   «         ¦  «        }t          d„ |D ¦   «         ¦  «        }||z
  ||z
  z
  }|D ]}|xj        |z  c_        Œ|D ]	}d	|_        Œ
|
|z   |z   ‰_        |                      ¦   «         r|
|gz   |z   ‰_        ‰| _         t          ‰j        ¦  «        |k    r‰j        |         | _         |s || ¦  «         dS dS )
z3
        edit the currently selected chunk
        c                 óJ  — |                       d¬¦  «        dz   | _        t          j        | j        | j        ¦  «        | _        |                      ¦   «          | j                             ¦   «          | j	                             ¦   «          | j         
                    d¦  «         d S )NTr  r   )rù  r'  r   r  r{  r˜  rR  r
  r  r¾  r  r$   s    r   Úupdateuiz0curseschunkselector.toggleedit.<locals>.updateui÷  s�   € Ø#×8Ò8ÀtÐ8ÑLÔLÈqÑPˆDÔÝ"œM¨$Ô*:¸DÔ<LÑMÔMˆDŒMØ×ÒÑÔÐØŒK×ÒÑ!Ô!Ð!ØŒN×"Ò"Ñ$Ô$Ð$ØŒK×Ò˜qÑ!Ô!Ð!Ð!Ð!r   c                 óT  — |€C| j                              t          d¦  «        ¦  «         | j                              d¦  «         d S |j                             ¦   «         rC| j                              t          d¦  «        ¦  «         | j                              d¦  «         d S t          ¦   «         }|                     t          t          z   ¦  «         |j                             |¦  «         |                     |¦  «         	 | j                              | 	                    ¦   «         dd¬¦  «        }n[# t          j        $ rI}|j        | _        Y d }~| j                             ¦   «          | j                             ¦   «          d S d }~ww xY w	 | j                             ¦   «          | j                             ¦   «          n7# | j                             ¦   «          | j                             ¦   «          w xY wd„ |                     ¦   «         D ¦   «         }t%          j        |¦  «        S )Ns    cannot edit patch for whole filer�  s!   cannot edit patch for binary filer   s   diff)Úactionc                 óB   — g | ]}|                      d ¦  «        °|dz   ‘ŒS )ó   #r�  )r    )rL   r�   s     r   rN   zOcurseschunkselector.toggleedit.<locals>.editpatchwitheditor.<locals>.<listcomp>  s>   € ð ð ð àØ—’ tÑ,Ô,ðØ�u‘ðð ð r   )r   r¹   r   rD   ÚbinaryrV   ÚdiffhelptextÚhunkhelptextr  rX   r	   ÚAbortÚmessager  r
  rÿ   r  Ú
splitlinesrÄ   Ú
parsepatch)r%   Úchunkr
   Úexcs       r   Úeditpatchwitheditorz;curseschunkselector.toggleedit.<locals>.editpatchwitheditorÿ  sþ  € Øˆ}Ø”—’�aÐ CÑDÔDÑEÔEÐEØ”—’˜eÑ$Ô$Ð$Ø�tØŒ|×"Ò"Ñ$Ô$ð Ø”—’�aÐ DÑEÔEÑFÔFÐFØ”—’˜eÑ$Ô$Ð$Ø�tõ ‘J”JˆEØ�KŠK�¥|Ñ3Ñ4Ô4Ð4ØŒL×Ò˜uÑ%Ô%Ð%Ø�KŠK˜ÑÔÐð&ØœŸš U§^¢^Ñ%5Ô%5°sÀ7˜ÑKÔK��øÝ”;ð ð ð Ø #¤�”Ø�t�t�tà”×!Ò!Ñ#Ô#Ð#Ø”×#Ò#Ñ%Ô%Ð%Ð%Ð%øøøøðøøøð ð
 ”×!Ò!Ñ#Ô#Ð#Ø”×#Ò#Ñ%Ô%Ð%Ð%øð ”×!Ò!Ñ#Ô#Ð#Ø”×#Ò#Ñ%Ô%Ð%Ð%øøøðð à!×,Ò,Ñ.Ô.ðñ ô ˆEõ
 Ô& uÑ-Ô-Ð-s0   Ä/D2 Ä1G Ä2F
ÅFÅG ÆF
Æ
G Ç4G5Nr   r   c                 ó0   •— g | ]}t          |‰¦  «        ‘ŒS r   rJ   )rL   rM   rD   s     €r   rN   z2curseschunkselector.toggleedit.<locals>.<listcomp>8  s#   ø€ ÐDÐDÐD¨!•F˜1˜fÑ%Ô%ÐDÐDÐDr   c                 ó   — g | ]	}|j         ‘Œ
S r   )r®   rÕ   s     r   rN   z2curseschunkselector.toggleedit.<locals>.<listcomp>9  s   € Ð2Ð2Ð2 A˜œÐ2Ð2Ð2r   c                 ó   — g | ]	}|j         ‘Œ
S r   )r�   rÕ   s     r   rN   z2curseschunkselector.toggleedit.<locals>.<listcomp>:  s   € Ð6Ð6Ð6¨˜!œ)Ð6Ð6Ð6r   F)r  rÒ   rG   rw   r2   rK   rS   r`   r®   r�   rD   Úsumr°   r4   Ú
emptypatchr_   )r%   r9   r	  r3  rA  Ú	itemindexÚbeforeaddedÚbeforeremovedÚ
newpatchesÚeditedhunkindexÚhunksbeforeÚ
hunksafterÚnewpatchheaderÚnewhunksÚnewaddedÚ
newremovedÚoffsetrM   rD   s                     @r   Ú
toggleeditzcurseschunkselector.toggleeditò  sU  ø€ ð
	"ð 	"ð 	"ð 	.ð  	.ð  	.ðD ˆ<ØÔ+ˆDÝ�d�HÑ%Ô%ð 	ØˆFÝ�d�JÑ'Ô'ð 	%Ø—?’?Ñ$Ô$ˆDÝ˜$¥Ñ'Ô'ð 	ØˆFð —O’OÑ%Ô%Ô+×1Ò1°$Ñ7Ô7ˆ	à%)¤Z°´�]ˆØ(Ð(¨¨tÑ4Ô4ˆ
ØÐØð Ø�˜‘”�ØˆFØ”ˆØ œ,×,Ò,¨TÑ2Ô2ˆØ”lÐ#3 OÐ#3Ô4ˆØ”\ /°AÑ"5Ð"7Ð"7Ô8ˆ
Ø# AœˆØDÐDÐDÐD¨~Ô/CÐDÑDÔDˆÝÐ2Ð2¨Ð2Ñ2Ô2Ñ3Ô3ˆÝÐ6Ð6¨XÐ6Ñ6Ô6Ñ7Ô7ˆ
Ø˜[Ñ(¨Z¸-Ñ-GÑHˆàð 	ð 	ˆAØˆHŒH˜ÑˆHŒHˆHØð 	ð 	ˆAØˆAŒHˆHØ" XÑ-°
Ñ:ˆŒØ�?Š?ÑÔð 	=Ø&¨$¨Ñ/°*Ñ<ˆFŒLØ#)ˆÔ ÝˆvŒ|ÑÔ˜yÒ(Ð(Ø'-¤|°IÔ'>ˆDÔ$àð 	ØˆH�T‰NŒNˆNˆNˆNð	ð 	r   c                 ó:   — | j         }|sdS |D ]}|j        r dS ŒdS ry   )rC   rS   )r%   r9   rD   s      r   rF  zcurseschunkselector.emptypatchK  s@   € ØŒˆØð 	Ø�4Øð 	ð 	ˆFØŒ|ð Ø�u�uðàˆtr   c                 ó   — |dv r|                       ¦   «          dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv r!t          j        t          d	¦  «        ¦  «        ‚|d
v r|  
                    ¦   «          dS |dv rdS |dv r"|                      ¦   «         rd| j        d<   dS dS |r|dv rd| j        d<   dS |dv r|                      ¦   «          dS |dv r,|                      ¦   «          |                      |¬¦  «         dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv r|                      |¬¦  «         dS |dv r|                      ¦   «          dS |dv r|                      d¬¦  «         dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv r|                      ¦   «          dS |dv rH|                      ¦   «          | j                             ¦   «          | j                             ¦   «          dS |t4          j                             d¦  «        fv rN|                      | j        ¦  «         | j                             ¦   «          | j                             ¦   «          dS dS )zd
        Perform actions based on pressed keys.

        Return true to exit the main loop.
        )ÚkÚKEY_UP)ÚKÚ	KEY_PPAGE)ÚjÚKEY_DOWN)ÚJÚ	KEY_NPAGE)r¢   Ú	KEY_RIGHT)rM   ÚKEY_LEFT)ÚHÚ	KEY_SLEFT)Úqs	   user quit)Úa)rÓ   T)Úrs   review)ÚR)ú rZ   )r  Ú	KEY_ENTERr  )ÚX)ÚA)Úe)r÷   )ÚF)rv  rŽ  )ÚgÚKEY_HOME)ÚGÚKEY_END)ú?ÚLN)r2  r5  r7  r9  rC  rF  rH  r	   ÚCanceledErrorr   rn  r/  rð   rj  rA  rt  rl  rS  r>  r   r"  r$  r  r
  rÿ   r  r   ÚasciiÚctrlrK  r!  )r%   Ú
keypressedr	  s      r   r  z$curseschunkselector.handlekeypressedT  sæ  € ð ˜Ð(Ð(Ø×ÒÑÔÐÐÐØÐ-Ð-Ð-Ø×"Ò"Ñ$Ô$Ð$Ð$Ð$ØÐ,Ð,Ð,Ø×ÒÑ!Ô!Ð!Ð!Ð!ØÐ-Ð-Ð-Ø×$Ò$Ñ&Ô&Ð&Ð&Ð&ØÐ-Ð-Ð-Ø× Ò Ñ"Ô"Ð"Ð"Ð"ØÐ,Ð,Ð,Ø×ÒÑ!Ô!Ð!Ð!Ð!ØÐ-Ð-Ð-Ø×$Ò$Ñ&Ô&Ð&Ð&Ð&Ø˜5Ð Ð ÝÔ%¥a¨¡o¤oÑ6Ô6Ð6Ø˜5Ð Ð Ø×ÒÑ!Ô!Ð!Ð!Ð!Ø˜5Ð Ð Ø�4Ø˜5Ð Ð Ø× Ò Ñ"Ô"ð Ø'+�”	˜)Ñ$Ø�tðð ð ð !	"�j EÐ)Ð)Ø#'ˆDŒI�iÑ Ø�4Ø˜:Ð%Ð%Ø×ÒÑÔÐÐÐØÐ.Ð.Ð.Ø×ÒÑÔÐØ×Ò 4ÐÑ(Ô(Ð(Ð(Ð(Ø˜5Ð Ð Ø×!Ò!Ñ#Ô#Ð#Ð#Ð#Ø˜5Ð Ð Ø�NŠNÑÔÐÐÐØ˜5Ð Ð Ø�OŠO ˆOÑ&Ô&Ð&Ð&Ð&Ø˜5Ð Ð Ø×ÒÑÔÐÐÐØ˜5Ð Ð Ø×Ò¨ÐÑ.Ô.Ð.Ð.Ð.Ø˜5Ð Ð Ø×$Ò$Ñ&Ô&Ð&Ð&Ð&ØÐ,Ð,Ð,Ø×%Ò%Ñ'Ô'Ð'Ð'Ð'ØÐ+Ð+Ð+Ø×$Ò$Ñ&Ô&Ð&Ð&Ð&Ø˜5Ð Ð Ø�OŠOÑÔÐØŒK×ÒÑÔÐØŒK×ÒÑ!Ô!Ð!Ð!Ð!Ø�FœL×-Ò-¨cÑ2Ô2Ð3Ð3Ð3ð ×Ò˜TÔ7Ñ8Ô8Ð8ØŒK×ÒÑÔÐØŒK×ÒÑ!Ô!Ð!Ð!Ð!ð 4Ð3r   c                 ód  — t          ¦   «         x}}t          j        t          d¦  «        r$t          j        t          j        | j        ¦  «        }	 |                      |¦  «        ||ur t          j        t          j        |¦  «         S S # ||ur t          j        t          j        |¦  «         w w xY w)zP
        method to be wrapped by curses.wrapper() for selecting chunks.
        s   SIGWINCH)rç   r   rè   ré   ÚSIGWINCHr  Ú_main)r%   r
  Úorigsigwinchrò   s       r   rî   zcurseschunkselector.main•  s£   € õ
 #)¡(¤(Ð*ˆ�xÝÔ�F KÑ0Ô0ð 	PÝ!œ=­¬¸$Ô:NÑOÔOˆLð	=Ø—:’:˜fÑ%Ô%à 8Ð+Ð+Ý”�fœo¨|Ñ<Ô<Ð<Ð<ð ,øˆ| 8Ð+Ð+Ý”�fœo¨|Ñ<Ô<Ð<Ð<ð ,øøøs   ÁB	 Â	&B/c                 óŽ  — || _         d | _        | j                              ¦   «         \  | _        | _        t          j        ¦   «          	 t          j        ¦   «          n# t
          j        $ r
 d| _	        Y nw xY w| j          
                    ¦   «          	 t          j        d¦  «         n# t
          j        $ r Y nw xY w|                      d d d¬¦  «         |                      t
          j        t
          j        d¬¦  «         |                      t
          j        d d¬¦  «         |                      t
          j        d d¬¦  «         |                      t
          j        t
          j        d¬¦  «         t          j        | j        ddd¦  «        | _        | j                             d	¦  «         t          j        d	| j        ¦  «        | _        |                      d
¬¦  «        d	z   | _        	 t          j        | j        | j        ¦  «        | _        n7# t
          j        $ r% t5          t7          d¦  «        ¦  «        | _        Y d S w xY w|                      | j        d¬¦  «        | _        	 |                      ¦   «          	 | j                              d¦  «        5  | j         !                    ¦   «         }d d d ¦  «         n# 1 swxY w Y   | j"        �d | _"        Œpn# t
          j        $ r d}Y nw xY w|  #                    |¦  «        rnŒž| j$        dk    r2tK          j&        dd| j$        ¦  «        }|dk    r| j$        | j'        d<   d S d S d S )NFr   rÕ  ré  rÔ  rë  rê  rÇ  r   Tr  s&   this diff is too large to be displayedrø  r  s   foobarr   s   (?m)^\s.*(\n|$)s   message)(r
  rï   ÚgetmaxyxrJ  r{  r   Ústart_colorÚuse_default_colorsr	   r  rÿ   Úcurs_setr  ÚCOLOR_WHITEÚCOLOR_MAGENTAÚ	COLOR_REDÚCOLOR_GREENÚ
COLOR_BLUEr  r(  r¾  r  r  r˜  rù  r'  r   r   r  r"  rË  r   r  r  r  r  r*  r’  r“  rð   )r%   r
  ru  Úwhitespaceremoveds       r   rx  zcurseschunkselector._main£  sÆ  € ØˆŒð ˆŒØ-1¬[×-AÒ-AÑ-CÔ-CÑ*ˆÔ˜$Ô*åÔÑÔÐð	"ÝÔ%Ñ'Ô'Ð'Ð'øÝŒ|ð 	"ð 	"ð 	"Ø!ˆDŒMˆMˆMð	"øøøð 	Œ×ÒÑÔÐð	ÝŒO˜AÑÔÐÐøÝŒ|ð 	ð 	ð 	ØˆDð	øøøð
 	×Ò˜4 ¨IÐÑ6Ô6Ð6Ø×ÒÝÔ¥Ô 4¸;ð 	ñ 	
ô 	
ð 	
ð 	×Ò�6Ô+¨T¸ÐÑDÔDÐDØ×Ò�6Ô-¨t¸+ÐÑFÔFÐFØ×ÒÝÔ¥Ô 1¸	ð 	ñ 	
ô 	
ð 	
õ  œ tÔ':¸A¸qÀ!ÑDÔDˆŒØŒ×Ò˜aÑ Ô Ð õ œ a¨Ô)9Ñ:Ô:ˆŒð  ×4Ò4À4Ð4ÑHÔHÈ1ÑLˆÔð	Ý"œM¨$Ô*:¸DÔ<LÑMÔMˆDŒMˆMøÝŒ|ð 	ð 	ð 	Ý(ÝÐ;Ñ<Ô<ñô ˆDŒLð ˆFˆFð		øøøð $(×#<Ò#<ØÔ$°eð $=ñ $
ô $
ˆÔ ð	Ø×ÒÑÔÐð'Ø”W×/Ò/°
Ñ;Ô;ð 9ð 9Ø!%¤×!6Ò!6Ñ!8Ô!8�Jð9ð 9ð 9ñ 9ô 9ð 9ð 9ð 9ð 9ð 9ð 9øøøð 9ð 9ð 9ð 9à”=Ð,Ø$(�D”MØð -øõ ”<ð 'ð 'ð 'Ø&�
�
�
ð'øøøà×$Ò$ ZÑ0Ô0ð Øð	ð Ô˜sÒ"Ð"Ý "¤Ø# S¨$Ô*:ñ!ô !Ðð ! CÒ'Ð'Ø(,Ô(8�”	˜*Ñ%Ð%Ð%ð #Ð"ð (Ð'sl   Á	A ÁA6Á5A6ÂB( Â(B:Â9B:Ç*$H È0IÉIÉ=K ÊJ=Ê1K Ê=KËK ËKËK ËK,Ë+K,rA   )F)NF)NNNNNTTF)FTF)TF)FT)NFTTr>   )NFT)NNNN)1r   r   r   rE   r2  r5  r7  r9  rA  rC  rF  rH  rR  rK  rj  rl  rn  rt  r>  r…  r±  rº  rÅ  rË  rÐ  rß  rå  rç  rí  rÊ  rö  rû  rï  rù  r  r•  r  r  r   r"  r$  r+  r/  r4  rS  rF  r  rî   rx  r   r   r   ræ   ræ   w  s}  € € € € € ð@#ð @#ð @#ð @#ðD,ð ,ð ,ð&%ð %ð %ð&,ð ,ð ,ð$%ð %ð %ð,)ð )ð )ð )ð&,ð ,ð ,ð",ð ,ð ,ð2/ð /ð /ð,:ð :ð :ð$>ð >ð >ð\ð \ð \ð \ð|
Hð 
Hð 
Hð+ð +ð +ð(+ð (+ð (+ðT*ð *ð *ð *ð((ð (ð (ð& ØØØØØØØðcð cð cð cðJð ð ð0Mð Mð Mð0ð ð ð>ð ð ðD AFð+ð +ð +ð +ð\ ?Dð*ð *ð *ð *ðXð ð ð ðð ð ð ð4 KOð ð  ð  ð  ð($ð $ð $ðð ð ð CGð@ð @ð @ð @ðF ?Cðð ð ð ð&	ð 	ð 	ð ?Cð9ð 9ð 9ð 9ðv+ð +ð +ð2ð 2ð 2ðh	ð 	ð 	ð/ð /ð /ð %ð %ð %ð.ð ð ð*ð ð ð0ð ð ðWð Wð Wð Wðrð ð ð?"ð ?"ð ?"ð ?"ðB=ð =ð =ðO9ð O9ð O9ð O9ð O9r   ræ   rA   )(r  r’  ré   Úi18nr   r   r   r   Ú r   r   r	   r
   rÄ   r   r   Úutilsr   rV   r9  r:  Úpatchhelptextr   Úcurses.asciiÚImportErrorr5   r;  r   r   r   rÙ   rG   rw   rK   rä   rÜ   rú   r  r,  ræ   r   r   r   ú<module>r‹     so  ðð 
€	€	€	Ø 	€	€	€	Ø €€€à Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð Ð Ð Ð Ð Ð àŒ=€ð ˆqðñô €ð ˆqðñô €ð �ðñô €ðØ€M€M€MØÐÐÐà
„L€L€LøØ�^Ð$ð ð ð Ø€F€F€FðøøøðOð Oð Oð Oð O�E”Kñ Oô Oð OðBð Bð Bðh!ð h!ð h!ð h!ð h!ñ h!ô h!ð h!ðV	 ð 	 ð 	 ð 	 ð 	 ˆI�tñ 	 ô 	 ð 	 ðK/ð K/ð K/ð K/ð K/ˆyñ K/ô K/ð K/ð\/ð /ð /ð /ð /�ñ /ô /ð /ðdFAð FAð FAð FAð FAˆYñ FAô FAð FAðR "ð  "ð  "ð  "ðFð ð ð ð,ð ð ðð ð ð ð6 ˆaÐ(Ñ)Ô)Ø�Ð,Ñ-Ô-ØˆQÐ&Ñ'Ô'Ø
ˆ!Ð%Ñ
&Ô
&ð	ð €ð{9ð {9ð {9ð {9ð {9ñ {9ô {9ð {9ð {9ð {9s   ÁA, Á,	A8Á7A8