7ec@sddlZddlTddlmZdefdYZdddYZdefd YZd efd YZd efd YZdZ e dkrddl m Z e e ndS(iN(t*(t Delegatort UndoDelegatorcBseZdZdZdZdZdZdZdZdZ dZ dZ d Z dd Zdd Zd Zd ZedZdZdZRS(icCstj||jdS(N(Rt__init__t reset_undo(tself((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRs cCs|jdk r9|jd|jd|jdntj|||dk r|jd|j|jd|j|jd|jndS(Ns<>s<>s<>( tdelegatetNonetunbindRt setdelegatetbindt undo_eventt redo_eventt dump_event(RR((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR s   cCslddlm}||j|j dG|jGdG|jGdG|jGdG|jGH||j|jdS(Ni(tpprintspointer:ssaved:s can_merge:s get_saved():tbreak(Rtundolisttpointertsavedt can_merget get_saved(RteventR((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR &s   cCs5d|_d|_g|_d|_|jddS(Niii(t was_savedRRt undoblockt set_saved(R((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR0s     cCs5|r|j|_n d|_t|_|jdS(Ni(RRtFalseRt check_saved(Rtflag((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR7s   cCs|j|jkS(N(RR(R((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR?scCs ||_dS(N(tsaved_change_hook(Rthook((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pytset_saved_change_hookDsicCsA|j}||jkr=||_|jr=|jq=ndS(N(RRR(Rtis_saved((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRIs    cCs|jt|||dS(N(taddcmdt InsertCommand(Rtindextcharsttags((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pytinsertPscCs|jt||dS(N(R t DeleteCommand(Rtindex1tindex2((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pytdeleteSscCs/|jdkrt|_n|jjdS(Ni(RtCommandSequencet bump_depth(R((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pytundo_block_startascCsz|jjddkrv|j}d|_t|dkrvt|dkr`|jd}n|j|dqvndS(Niii(RR+tlentgetcmdR (Rtcmd((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pytundo_block_stopfs  cCs-|r|j|jn|jdkr<|jj|dS|jr~|jdkr~|j|jd}|j|r~dSn|g|j|j)|j|jkrd|_n|jd|_t |j|j kr|jd=|jd|_|jdkr|jd|_qnt |_|j dS(Niii( tdoRRtappendRRRtmergeRR-tmax_undotTrueR(RR/texecutetlastcmd((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR rs(   cCsh|jdkr|jdS|j|jd}|j|j|jd|_t|_|jdS(NiRi(RtbellRtundoRRRR(RRR/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR s   cCsm|jt|jkr&|jdS|j|j}|j|j|jd|_t|_|jdS(NRi( RR-RR8tredoRRRR(RRR/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR s   N(t__name__t __module__R4RR R RRRRRRRRR%R)R,R0R5R R R (((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRs$           tCommandcBsYeZdZddZdZdZdZdZdZ dZ dZ RS( cCsCi|_i|_||_||_||_|r?||_ndS(N(t marks_beforet marks_afterR'R(R#R$(RR'R(R#R$((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRs     cCsT|jj}|j|j|j|jf}|jdkrF|d }n|t|S(Ni(t __class__R;R'R(R#R$Rtrepr(Rtstt((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyt__repr__s   cCsdS(N((Rttext((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR1scCsdS(N((RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR:scCsdS(N((RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR9scCsdS(Ni((RR/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR3scCsOi}xB|jD]4}|dkr|dkr|j|||send-1cs%s+%dc( RJR>R"R'tcompareR%R#R$R-R(R?(RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR1s(cCsS|jd|j|j|j|j|j|j||j|jddS(NR%(RLR'R%R#R$RMR?tsee(RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR:scCsM|jd|j|j|j|j|j||j|jddS(NR%(RLR'R)R(RMR>RP(RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR9scCs|j|jk rtS|j|jkr,tS|j|jkrBtSt|jdkr[tS|jr|j|jd|j|jkrtS|j|_|j|j|_tS(Nii( R@RR(R'R$R-R#tclassifyR5(RR/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR3s ( t_cCs'||jkrdS|dkr#dSdS(Nt alphanumerics tnewlinet punctuation(RS(Rtc((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRQs  N( R;R<RRR1R:R9R3tstringt ascii_letterstdigitsRSRQ(((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR!s    R&cBs/eZddZdZdZdZRS(cCstj|||dddS(N(R=RR(RR'R(((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR scCs|j||_|j|j|_|jrH|j|j|_n|j|jd|_|j|jddr|jd|_n|j|j|j|_|j|j|j|j||_ dS(Ns +1cRNsend-1c( RJR>R"R'R(ROtgetR#R)R?(RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR1s cCsM|jd|j|j|j|j|j||j|jddS(NR%(RLR'R)R(RMR?RP(RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR:scCsM|jd|j|j|j|j|j||j|jddS(NR%(RLR'R%R#RMR>RP(RRE((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR9%sN(R;R<RRR1R:R9(((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR&s   R*cBsSeZdZdZdZdZdZdZdZddZ RS( cCsg|_d|_dS(Ni(tcmdstdepth(R((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR1s cCsS|jj}g}x%|jD]}|jd|fqW|ddj|dS(Ns %rs( s, s )(R@R;R[R2tjoin(RRBtstrsR/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRD5s  cCs t|jS(N(R-R[(R((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyt__len__<scCs|jj|dS(N(R[R2(RR/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR2?scCs |j|S(N(R[(Rti((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR.BscCs%x|jD]}|j|q WdS(N(R[R:(RRER/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR:EscCs6|j}|jx|D]}|j|qWdS(N(R[treverseR9(RRER[R/((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR9Is   icCs|j||_|jS(N(R\(Rtincr((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR+Os( R;R<RRDR_R2R.R:R9R+(((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyR*,s       c sgddlm}t}|jdttttjd|j \}}}}|j d||dft |}|j dd|j |j ||}t|jt|d d d fd } | j d dt|d dd fd} | j d dt|d dd fd} | j d d|jdS(Ni(t PercolatorsTest UndoDelegators[x+]s+%d+%ditheighti REtUndotcommandcs jdS(N(R R((td(s-/usr/lib64/python2.7/idlelib/UndoDelegator.pytbttsidetlefttRedocs jdS(N(R R((Rg(s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRhdRitDumpcs jdS(N(R R((Rg(s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyRhfRi(tidlelib.PercolatorRctTkttitletlisttmaptinttretsplittgeometrytTexttconfigtpackt focus_setRt insertfiltertButtontmainloop( tparentRctroottwidthRdtxtyREtpR9R:tdump((Rgs-/usr/lib64/python2.7/idlelib/UndoDelegator.pyt_undo_delegatorSs&  3      !!!t__main__(trun(( RWtTkintertidlelib.DelegatorRRR=R!R&R*RR;tidlelib.idle_test.htestR(((s-/usr/lib64/python2.7/idlelib/UndoDelegator.pyts  .:$'