PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  pY:@sdZddlmZddlmZdddddd iZd ZGd d d Zed krddl Z e j ddddS)zParenMatch -- An IDLE extension for parenthesis matching. When you hit a right paren, the cursor should move briefly to the left paren. Paren here is used generically; the matching applies to parentheses, square brackets, and curly braces. ) HyperParser)idleConf)(][}{dc@sHeZdZdZdd1gfgZejdddddZejddd d d dd Zej ej d Z ejdddd dddZ dZ d2ZddZddZddZddZddZd d!Zd"d#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd"S)3 ParenMatchaHighlight matching parentheses There are three supported style of paren matching, based loosely on the Emacs options. The style is select based on the HILITE_STYLE attribute; it can be changed used the set_style method. The supported styles are: default -- When a right paren is typed, highlight the matching left paren for 1/2 sec. expression -- When a right paren is typed, highlight the entire expression from the left paren to the right paren. TODO: - extend IDLE with configuration dialog to change options - implement rest of Emacs highlight styles (see below) - print mismatch warning in IDLE status window Note: In Emacs, there are several styles of highlight where the matching paren is highlighted whenever the cursor is immediately to the right of a right paren. I don't know how to do that in Tk, so I haven't bothered. ZeditShow surrounding parens<> extensionsstyledefault expressionz flash-delaytypeintiZhilitebellboolz<> cCsT||_|j|_|jj|j|jd|_d|_|j|jdS)Nr) editwintextbindRESTORE_VIRTUAL_EVENT_NAME restore_eventcounteris_restore_active set_styleSTYLE)selfrr%)/opt/python35/lib/python3.5/ParenMatch.py__init__;s     zParenMatch.__init__cCs@|js<x'|jD]}|jj|j|qWd|_dS)NT)r!RESTORE_SEQUENCESrZ event_addr)r$seqr%r%r&activate_restoreGs zParenMatch.activate_restorecCs@|jr<x'|jD]}|jj|j|qWd|_dS)NF)r!r(rZ event_deleter)r$r)r%r%r&deactivate_restoreMs zParenMatch.deactivate_restorecCsX||_|dkr0|j|_|j|_n$|dkrT|j|_|j|_dS)Nrr)r#create_tag_default create_tagset_timeout_last set_timeoutcreate_tag_expressionset_timeout_none)r$rr%r%r&r"Ss     zParenMatch.set_stylecCsWt|jdj}|dkr2|jdS|j|j||jdS)Ninsert)rrget_surrounding_bracketswarn_mismatchedr*r-r.)r$eventindicesr%r%r&flash_paren_event\s    zParenMatch.flash_paren_eventcCs|jjd}|tkr"dSt|jd}|jsDdS|jt|d}|dkrt|jdS|j|j ||j dS)Nz insert-1cT) rget_openersrrZ is_in_coder3r4r*r-r/)r$r5ZcloserZhpr6r%r%r&paren_closed_eventfs      zParenMatch.paren_closed_eventNcCs-|jjd|j|jd7_dS)Nparenr)rZ tag_deleter+r )r$r5r%r%r&rvs zParenMatch.restore_eventcCs||jkr|jdS)N)r r)r$Z timer_countr%r%r&handle_restore_timer{szParenMatch.handle_restore_timercCs|jr|jjdS)N)BELLrr)r$r%r%r&r4s zParenMatch.warn_mismatchedcCs1|jjd|d|jjd|jdS)z'Highlight the single paren that matchesr;rN)rtag_add tag_config HILITE_CONFIG)r$r6r%r%r&r,szParenMatch.create_tag_defaultcCsk|jj|dd kr-|dd}n |d}|jjd|d||jjd|jdS) zHighlight the entire expressionrrrrz+1cr;rN)rrr)rr8r>r?r@)r$r6Z rightindexr%r%r&r0s  z ParenMatch.create_tag_expressioncCsP|jd7_||j|jjddd}|jjjt||dS)zSHighlight will remain until user input turns it off or the insert has movedrr2cSsE||jjdkr(|j|n|jjjt||dS)Nr2)rindexr<r text_frameafter CHECK_DELAY)callmer$crAr%r%r&rEsz+ParenMatch.set_timeout_none..callmeN)r rrArrBrCrD)r$rEr%r%r&r1s zParenMatch.set_timeout_nonecCs;|jd7_|jjj|j||jdddS)z7The last highlight created will be removed after .5 secrcSs |j|S)N)r<)r$rFr%r%r&sz-ParenMatch.set_timeout_last..N)r rrBrC FLASH_DELAY)r$r%r%r&r.s zParenMatch.set_timeout_last)r r )rrrr)__name__ __module__ __qualname____doc__ZmenudefsrZ GetOptionr#rHZ GetHighlightZ CurrentThemer@r=rr(r'r*r+r"r7r:rr<r4r,r0r1r.r%r%r%r&r s4         r __main__Nz!idlelib.idle_test.test_parenmatch verbosity) rLZidlelib.HyperParserrZidlelib.configHandlerrr9rDr rIZunittestmainr%r%r%r&s