ž ©ÿfA(c@s·ddlZddlTddlmZGdd„deƒZGdd„dƒZGdd „d eƒZGd d „d eƒZGd d „d eƒZdd„Z e dkr³e ƒndS(iN(u*(u DelegatorcBsã|EeZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z d!Z dd„Z d"Z dd„Zd!dd„Zd!dd„Zdd„Zdd„Zd#dd„Zdd„Zdd „Zd!S($u UndoDelegatoriècCstj|ƒ|jƒdS(N(u Delegatoru__init__u reset_undo(uself((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu__init__s uUndoDelegator.__init__cCs•|jdk r9|jdƒ|jdƒ|jdƒntj||ƒ|dk r‘|jd|jƒ|jd|jƒ|jd|jƒndS(Nu<>u<>u<>( udelegateuNoneuunbindu Delegatoru setdelegateubindu undo_eventu redo_eventu dump_event(uselfudelegate((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu setdelegates   uUndoDelegator.setdelegatecCsddlm}||jd|j…ƒtd|jddƒtd|jddƒtd|jddƒtd|jƒƒ||j|jd…ƒd S( Ni(upprintupointer:uendu usaved:u can_merge:u get_saved():ubreak(upprintuundolistupointeruprintusavedu can_mergeu get_saved(uselfueventupprint((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu dump_event&suUndoDelegator.dump_eventcCs5d|_d|_g|_d|_|jdƒdS(Niiiÿÿÿÿ(u was_savedupointeruundolistu undoblocku set_saved(uself((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu reset_undo0s     uUndoDelegator.reset_undocCs5|r|j|_n d|_d|_|jƒdS(NiiÿÿÿÿF(upointerusaveduFalseu can_mergeu check_saved(uselfuflag((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu set_saved7s   uUndoDelegator.set_savedcCs|j|jkS(N(usavedupointer(uself((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu get_saved?suUndoDelegator.get_savedcCs ||_dS(N(usaved_change_hook(uselfuhook((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuset_saved_change_hookDsu#UndoDelegator.set_saved_change_hookicCsA|jƒ}||jkr=||_|jr=|jƒq=ndS(N(u get_savedu was_savedusaved_change_hook(uselfuis_saved((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu check_savedIs    uUndoDelegator.check_savedcCs|jt|||ƒƒdS(N(uaddcmdu InsertCommand(uselfuindexucharsutags((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuinsertPsuUndoDelegator.insertcCs|jt||ƒƒdS(N(uaddcmdu DeleteCommand(uselfuindex1uindex2((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyudeleteSsuUndoDelegator.deletecCs/|jdkrtƒ|_n|jjƒdS(Ni(u undoblockuCommandSequenceu bump_depth(uself((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuundo_block_startasuUndoDelegator.undo_block_startcCsz|jjdƒdkrv|j}d|_t|ƒdkrvt|ƒdkr`|jdƒ}n|j|dƒqvndS(Niiiÿÿÿÿ(u undoblocku bump_depthulenugetcmduaddcmd(uselfucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuundo_block_stopfs  uUndoDelegator.undo_block_stopcCs3|r|j|jƒn|jdkr<|jj|ƒdS|jr~|jdkr~|j|jd}|j|ƒr~dSn|g|j|jd…<|j|jkrµd|_n|jd|_t |jƒ|j kr|jd=|jd|_|jdkr|jd|_qnd|_|j ƒdS(NiiiÿÿÿÿT( udoudelegateu undoblockuappendu can_mergeupointeruundolistumergeusavedulenumax_undouTrueu check_saved(uselfucmduexecuteulastcmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuaddcmdrs(   uUndoDelegator.addcmdcCsh|jdkr|jƒdS|j|jd}|j|jƒ|jd|_d|_|jƒdS(NiubreakiF(upointerubelluundolistuundoudelegateuFalseu can_mergeu check_saved(uselfueventucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu undo_event‰s   uUndoDelegator.undo_eventcCsm|jt|jƒkr&|jƒdS|j|j}|j|jƒ|jd|_d|_|jƒdS(NubreakiF( upointerulenuundolistubelluredoudelegateuFalseu can_mergeu check_saved(uselfueventucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu redo_event”s   uUndoDelegator.redo_eventNiÿÿÿÿT(u__name__u __module__u __qualname__umax_undou__init__u setdelegateu dump_eventu reset_undou set_savedu get_saveduNoneusaved_change_hookuset_saved_change_hooku was_savedu check_saveduinsertudeleteuundo_block_startuundo_block_stopuTrueuaddcmdu undo_eventu redo_event(u __locals__((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu UndoDelegators$         u UndoDelegatorcBs}|EeZdZdZddd„Zdd„Zdd„Zdd„Zd d „Z d d „Z d d„Z dd„Z dS(uCommandcCsCi|_i|_||_||_||_|r?||_ndS(N(u marks_beforeu marks_afteruindex1uindex2ucharsutags(uselfuindex1uindex2ucharsutags((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu__init__¦s     uCommand.__init__cCsZ|jj}|j|j|j|jf}|jdkrL|dd…}n|t|ƒS(Niiÿÿÿÿ(u __class__u__name__uindex1uindex2ucharsutagsuNoneurepr(uselfusut((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu__repr__¯s  uCommand.__repr__cCsdS(N((uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyudo¶su Command.docCsdS(N((uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuredo¹su Command.redocCsdS(N((uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuundo¼su Command.undocCsdS(Ni((uselfucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyumerge¿su Command.mergecCsOi}xB|jƒD]4}|dkr|dkr|j|ƒ||uend-1cu%s+%dc( u save_marksu marks_beforeuindexuindex1ucompareuinsertucharsutagsulenuindex2u marks_after(uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyudoÕs(uInsertCommand.docCsS|jd|jƒ|j|j|j|jƒ|j||jƒ|jdƒdS(Nuinsert(umark_setuindex1uinsertucharsutagsu set_marksu marks_afterusee(uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuredoàsuInsertCommand.redocCsM|jd|jƒ|j|j|jƒ|j||jƒ|jdƒdS(Nuinsert(umark_setuindex1udeleteuindex2u set_marksu marks_beforeusee(uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuundoçsuInsertCommand.undocCs³|j|jk rdS|j|jkr,dS|j|jkrBdSt|jƒdkr[dS|jr|j|jdƒ|j|jƒkrdS|j|_|j|j|_dS(NiFiÿÿÿÿT( u __class__uFalseuindex2uindex1utagsulenucharsuclassifyuTrue(uselfucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyumergeîs ( uInsertCommand.mergeu_cCs'||jkrdS|dkr#dSdS(Nu alphanumericu unewlineu punctuation(u alphanumeric(uselfuc((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuclassifys  uInsertCommand.classifyN(u__name__u __module__u __qualname__uNoneu__init__udouredouundoumergeustringu ascii_lettersudigitsu alphanumericuclassify(u __locals__((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu InsertCommandÎs   u InsertCommandcBsG|EeZdZd dd„Zdd„Zdd„Zdd„Zd S( u DeleteCommandcCstj|||ddƒdS(N(uCommandu__init__uNone(uselfuindex1uindex2((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu__init__ suDeleteCommand.__init__cCsÕ|j|ƒ|_|j|jƒ|_|jrH|j|jƒ|_n|j|jdƒ|_|j|jddƒrŽ|jdƒ|_n|j|j|jƒ|_|j|j|jƒ|j|ƒ|_ dS(Nu +1cu>uend-1c( u save_marksu marks_beforeuindexuindex1uindex2ucompareugetucharsudeleteu marks_after(uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyudos uDeleteCommand.docCsM|jd|jƒ|j|j|jƒ|j||jƒ|jdƒdS(Nuinsert(umark_setuindex1udeleteuindex2u set_marksu marks_afterusee(uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuredosuDeleteCommand.redocCsM|jd|jƒ|j|j|jƒ|j||jƒ|jdƒdS(Nuinsert(umark_setuindex1uinsertucharsu set_marksu marks_beforeusee(uselfutext((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuundo%suDeleteCommand.undoN(u__name__u __module__u __qualname__uNoneu__init__udouredouundo(u __locals__((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu DeleteCommands  u DeleteCommandcBsw|EeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z ddd„Z dS(uCommandSequencecCsg|_d|_dS(Ni(ucmdsudepth(uself((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu__init__1s uCommandSequence.__init__cCsS|jj}g}x%|jD]}|jd|fƒqW|ddj|ƒdS(Nu %ru( u, u )(u __class__u__name__ucmdsuappendujoin(uselfusustrsucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu__repr__5s  uCommandSequence.__repr__cCs t|jƒS(N(ulenucmds(uself((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu__len__<suCommandSequence.__len__cCs|jj|ƒdS(N(ucmdsuappend(uselfucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuappend?suCommandSequence.appendcCs |j|S(N(ucmds(uselfui((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyugetcmdBsuCommandSequence.getcmdcCs%x|jD]}|j|ƒq WdS(N(ucmdsuredo(uselfutextucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuredoEsuCommandSequence.redocCs?|jdd…}|jƒx|D]}|j|ƒq$WdS(N(ucmdsureverseuundo(uselfutextucmdsucmd((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuundoIs  uCommandSequence.undoicCs|j||_|jS(N(udepth(uselfuincr((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyu bump_depthOsuCommandSequence.bump_depthN( u__name__u __module__u __qualname__u__init__u__repr__u__len__uappendugetcmduredouundou bump_depth(u __locals__((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyuCommandSequence,s       uCommandSequencecCsyddlm}tƒ}|jd|jƒtƒ}|jƒ|jƒ||ƒ}tƒ}|j |ƒ|j ƒdS(Ni(u PercolatoruWM_DELETE_WINDOW( uidlelib.Percolatoru PercolatoruTku wm_protocoluquituTextupacku focus_setu UndoDelegatoru insertfilterumainloop(u Percolatorurootutextupud((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyumainSs       umainu__main__( ustringutkinteruidlelib.Delegatoru Delegatoru UndoDelegatoruCommandu InsertCommandu DeleteCommanduCommandSequenceumainu__name__(((u:/opt/alt/python33/lib64/python3.3/idlelib/UndoDelegator.pyus  .:$'