tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
]\¬Qc@stdZddlZddlZd„Zdd    d„ƒYZedkrpd„ZejeƒZdGe    eƒGHndS(
s:Simple textbox editing widget with Emacs-like keybindings.iÿÿÿÿNcCsð|j|d|tj||dƒ|j||dtj||dƒ|j||dtj||dƒ|j|d|tj||dƒ|j||tjƒ|j||tjƒ|j||tjƒ|j||tj    ƒdS(s^Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    iN(
tvlinetcursest    ACS_VLINEthlinet    ACS_HLINEtaddcht ACS_ULCORNERt ACS_URCORNERt ACS_LRCORNERt ACS_LLCORNER(twintulytulxtlrytlrx((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyt    rectangles%%%%tTextboxcBsJeZdZed„Zd„Zd„Zd„Zd„Zdd„Z
RS(sdEditing widget using the interior of a window object.
     Supports the following Emacs-like key bindings:
 
    Ctrl-A      Go to left edge of window.
    Ctrl-B      Cursor left, wrapping to previous line if appropriate.
    Ctrl-D      Delete character under cursor.
    Ctrl-E      Go to right edge (stripspaces off) or end of line (stripspaces on).
    Ctrl-F      Cursor right, wrapping to next line when appropriate.
    Ctrl-G      Terminate, returning the window contents.
    Ctrl-H      Delete character backward.
    Ctrl-J      Terminate if the window is 1 line, otherwise insert newline.
    Ctrl-K      If line is blank, delete it, otherwise clear to end of line.
    Ctrl-L      Refresh screen.
    Ctrl-N      Cursor down; move down one line.
    Ctrl-O      Insert a blank line at cursor location.
    Ctrl-P      Cursor up; move up one line.
 
    Move operations do nothing if the cursor is at an edge where the movement
    is not possible.  The following synonyms are supported where possible:
 
    KEY_LEFT = Ctrl-B, KEY_RIGHT = Ctrl-F, KEY_UP = Ctrl-P, KEY_DOWN = Ctrl-N
    KEY_BACKSPACE = Ctrl-h
    cCsm||_||_|jƒ\|_|_|jd|_|jd|_d|_d|_|jdƒdS(Ni(    R
t insert_modetgetmaxyxtmaxytmaxxt stripspacestNonetlastcmdtkeypad(tselfR
R((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyt__init__+s                cCs{|j}xktrvtjj|jj||ƒƒtjjkrYt|j|dƒ}Pn|dkriPn|d}q W|S(suGo to the location of the first blank on the given line,
        returning the index of the last non-blank character.ii(RtTrueRtasciiR
tinchtSPtmin(Rtytlast((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyt _end_of_line5s        - cCsÖ|jjƒ\}}||jks3||jkrÒ|jrN|jjƒ}ny|jj|ƒWntjk
rxnX|jrÒ|jjƒ\}}tj    j
|ƒrÏ|j |ƒ|jj ||ƒqÏqÒndS(N( R
tgetyxRRRRRRterrorRtisprintt_insert_printable_chartmove(RtchR txtoldchtbackytbackx((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyR&Bs         cCse|jjƒ\}}||_tjj|ƒra||jksN||jkra|j|ƒqan|tjj    kr‰|jj
|dƒnØ|tjj tj tjj tjfkr`|dkrÙ|jj
||dƒnY|dkrènJ|jr|jj
|d|j|dƒƒn|jj
|d|jƒ|tjj tjfkra|jjƒqan|tjjkr‚|jjƒnß|tjjkrÕ|jr¼|jj
||j|ƒƒqa|jj
||jƒnŒ|tjjtjfkrE||jkr|jj
||dƒqa||jkr+qa|jj
|ddƒn|tjjkr[dS|tjjkr¬|jdkr€dS||jkra|jj
|ddƒqanµ|tjjkr|dkrï|j|ƒdkrï|jjƒqa|jj
||ƒ|jjƒnO|tjjkr4|jjƒn-|tjjtjfkr»||jkra|jj
|d|ƒ||j|dƒkr¸|jj
|d|j|dƒƒq¸qan¦|tjjkrÝ|jj ƒn„|tjj!tj"fkra|dkra|jj
|d|ƒ||j|dƒkr^|jj
|d|j|dƒƒq^qandS(s!Process a single editing command.ii(#R
R#RRRR%RRR&tSOHR'tSTXtKEY_LEFTtBSt KEY_BACKSPACERR"tdelchtEOTtENQtACKt    KEY_RIGHTtBELtNLtVTtdeletelntclrtoeoltFFtrefreshtSOtKEY_DOWNtSItinsertlntDLEtKEY_UP(RR(R R)((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyt
do_commandTsp    *      '    !- -c
Csãd}xÖt|jdƒD]Á}|jj|dƒ|j|ƒ}|dkr]|jr]qnx_t|jdƒD]J}|jr||krPn|ttj    j    |jj
||ƒƒƒ}qqW|jdkr|d}qqW|S(s.Collect and return the contents of the window.tiis
( trangeRR
R'R"RRtchrRRR(RtresultR tstopR)((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pytgather”s/cCs`xS|jjƒ}|r'||ƒ}n|s3qn|j|ƒsFPn|jjƒq|jƒS(s2Edit in the widget window and collect the results.(R
tgetchRDR=RJ(RtvalidateR(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pytedit¤sN( t__name__t
__module__t__doc__tFalseRR"R&RDRJRRM(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyRs
           @    t__main__cCs‡d\}}d    \}}|j|d|dƒtj||||ƒ}t||d|d||||ƒ|jƒt|ƒjƒS(
Ni    iiiisUse Ctrl-G to end editing.i(i    i(ii(taddstrRtnewwinRR=RRM(tstdscrtncolstnlinesR R R
((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyt test_editbox²s  &
sContents of text box:((
RPRt curses.asciiRRRNRXtwrappertstrtrepr(((sV/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/curses/textpad.pyt<module>s       ž