• File: textpad.cpython-38.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python38/lib64/python3.8/curses/__pycache__/textpad.cpython-38.pyc
  • Date Modified: 10/26/2026 8:15 PM
  • File size: 5.78 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
U

if@sVdZddlZddlZddZGdddZedkrRdd	ZeeZe	d
e
edS)z:Simple textbox editing widget with Emacs-like keybindings.NcCs||d|tj||d|||dtj||d|||dtj||d||d|tj||d|||tj|||tj|||tj|||tj	dS)z^Draw a rectangle with corners at the provided upper-left
    and lower-right coordinates.
    N)
ZvlinecursesZ	ACS_VLINEZhlineZ	ACS_HLINEaddchZACS_ULCORNERZACS_URCORNERZACS_LRCORNERZACS_LLCORNER)winulyulxZlryZlrxr3/opt/alt/python38/lib64/python3.8/curses/textpad.py	rectanglesr
c@sLeZdZdZdddZddZddZd	d
ZddZd
dZ	dddZ
dS)TextboxadEditing 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
    FcCs.||_||_|d|_d|_|ddSNr)rinsert_mode_update_max_yxstripspaceslastcmdZkeypad)selfrr
rrr	__init__+szTextbox.__init__cCs&|j\}}|d|_|d|_dSr)rZgetmaxyxmaxymaxx)rrrrrr	r3s
zTextbox._update_max_yxcCsX||j}tj|j||tjjkr@t|j|d}qTn
|dkrJqT|d}q|S)zuGo to the location of the first blank on the given line,
        returning the index of the last non-blank character.rr)rrrasciirinchZSPmin)ryZlastrrr	_end_of_line8s
zTextbox._end_of_linecCs||j\}}d}||jks.||jkr|jr>|j}z|j|Wntj	k
rdYnX|jrtj
|szq|}|j\}}|dkr||f}q|dk	r|jj|dS)N)
rrgetyxrrr
rrrerrorrisprintmove)rchrxZbackyxZoldchrrr	_insert_printable_charFs$

zTextbox._insert_printable_charcCsV||j\}}||_tj|rJ||jks<||jkrF|	|n|tjj
krh|j|dn|tjjtj
tjjtjfkr|dkr|j||dnB|dkrn8|jr|j|d||dn|j|d|j|tjjtjfkrR|jnL|tjjkr"|jn0|tjjkrb|jrN|j|||n|j||jn|tjjtjfkr||jkr|j||dn ||jkrn|j|ddn|tjjkrdS|tjjkr|jdkrdS||jkrR|j|ddnF|tjjkrZ|dkr@||dkr@|jn|j|||jn|tjjkrt|jn|tjjtjfkr||jkrR|j|d||||dkrR|j|d||dnz|tjj kr|j!n`|tjj"tj#fkrR|dkrR|j|d||||dkrR|j|d||ddS)z!Process a single editing command.rr)$rrrrrrrrrr ZSOHrZSTXZKEY_LEFTZBSZ
KEY_BACKSPACErrZdelchZEOTZENQZACKZ	KEY_RIGHTZBELNLZVTZdeletelnZclrtoeolZFFrefreshZSOZKEY_DOWNZSIZinsertlnZDLEZKEY_UP)rrrrrrr	
do_command_sr
zTextbox.do_commandc
Csd}|t|jdD]}|j|d||}|dkrF|jrFqt|jdD]4}|jrj||krjq|tt	j

|j||}qT|jdkr|d}q|S)z.Collect and return the contents of the window.rr
)rrangerrrrrrchrrrr)rresultrstoprrrr	gathers
 

zTextbox.gatherNcCs<|j}|r||}|sq||s(q4|jq|S)z2Edit in the widget window and collect the results.)rZgetchr#r"r*)rZvalidaterrrr	edits

zTextbox.edit)F)N)__name__
__module____qualname____doc__rrrr r#r*r+rrrr	rs
Ar__main__cCsfd\}}d\}}||d|dt||||}t||d|d|||||t|S)N)	)zUse Ctrl-G to end editing.r)ZaddstrrZnewwinr
r"rr+)ZstdscrZncolsZnlinesrrrrrr	test_editboxs r6zContents of text box:)r/rZcurses.asciir
rr,r6wrapperstrprintreprrrrr	<module>s
,