
    ^h                         S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  SS	KJr  S
S/r " S S
\S9r " S S\5      rg)z
Interface for an output.
    )annotations)ABCMetaabstractmethod)TextIO)CursorShapeSize)Attrs   )
ColorDepthOutputDummyOutputc                     \ rS rSr% SrSrS\S'   \S,S j5       r\S-S j5       r	\S.S j5       r
\S.S	 j5       r\S/S
 j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S0S j5       r\S1S j5       r\S0S j5       r\S0S j5       r\S2S3S jj5       r\S4S j5       r\S4S j5       r\S4S j5       r\S4S j5       r\S0S j5       r\S0S j5       r \S5S j5       r!\S0S  j5       r"S0S! jr#\$S6S" j5       r%\S7S# j5       r&S0S$ jr'S0S% jr(S0S& jr)S0S' jr*S0S( jr+S,S) jr,\S8S* j5       r-S+r.g)9r      z
Base class defining the output interface for a
:class:`~prompt_toolkit.renderer.Renderer`.

Actual implementations are
:class:`~prompt_toolkit.output.vt100.Vt100_Output` and
:class:`~prompt_toolkit.output.win32.Win32Output`.
NzTextIO | Nonestdoutc                    g)z@Return the file descriptor to which we can write for the output.N selfs    T/home/james-whalen/.local/lib/python3.13/site-packages/prompt_toolkit/output/base.pyfilenoOutput.fileno"           c                    g)z
Return the encoding for this output, e.g. 'utf-8'.
(This is used mainly to know which characters are supported by the
output the data, so that the UI can provide alternatives, when
required.)
Nr   r   s    r   encodingOutput.encoding&   r   r   c                    g)z?Write text (Terminal escape sequences will be removed/escaped.)Nr   r   datas     r   writeOutput.write/   r   r   c                    g)zWrite text.Nr   r   s     r   	write_rawOutput.write_raw3   r   r   c                    g)zSet terminal title.Nr   r   titles     r   	set_titleOutput.set_title7   r   r   c                    g)z/Clear title again. (or restore previous title.)Nr   r   s    r   clear_titleOutput.clear_title;   r   r   c                    g)z!Write to output stream and flush.Nr   r   s    r   flushOutput.flush?   r   r   c                    g)zK
Erases the screen with the background color and moves the cursor to
home.
Nr   r   s    r   erase_screenOutput.erase_screenC   r   r   c                    g)zBGo to the alternate screen buffer. (For full screen applications).Nr   r   s    r   enter_alternate_screenOutput.enter_alternate_screenJ   r   r   c                    g)z"Leave the alternate screen buffer.Nr   r   s    r   quit_alternate_screenOutput.quit_alternate_screenN   r   r   c                    g)zEnable mouse.Nr   r   s    r   enable_mouse_supportOutput.enable_mouse_supportR   r   r   c                    g)zDisable mouse.Nr   r   s    r   disable_mouse_supportOutput.disable_mouse_supportV   r   r   c                    g)zI
Erases from the current cursor position to the end of the current line.
Nr   r   s    r   erase_end_of_lineOutput.erase_end_of_lineZ   r   r   c                    g)zK
Erases the screen from the current line down to the bottom of the
screen.
Nr   r   s    r   
erase_downOutput.erase_down`   r   r   c                    g)z#Reset color and styling attributes.Nr   r   s    r   reset_attributesOutput.reset_attributesg   r   r   c                    g)z%Set new color and styling attributes.Nr   r   attrscolor_depths      r   set_attributesOutput.set_attributesk   r   r   c                    g)zDisable auto line wrapping.Nr   r   s    r   disable_autowrapOutput.disable_autowrapo   r   r   c                    g)zEnable auto line wrapping.Nr   r   s    r   enable_autowrapOutput.enable_autowraps   r   r   c                    g)zMove cursor position.Nr   r   rowcolumns      r   cursor_gotoOutput.cursor_gotow   r   r   c                    g)zMove cursor `amount` place up.Nr   r   amounts     r   	cursor_upOutput.cursor_up{   r   r   c                    g)z Move cursor `amount` place down.Nr   r\   s     r   cursor_downOutput.cursor_down   r   r   c                    g)z#Move cursor `amount` place forward.Nr   r\   s     r   cursor_forwardOutput.cursor_forward   r   r   c                    g)z$Move cursor `amount` place backward.Nr   r\   s     r   cursor_backwardOutput.cursor_backward   r   r   c                    g)zHide cursor.Nr   r   s    r   hide_cursorOutput.hide_cursor   r   r   c                    g)zShow cursor.Nr   r   s    r   show_cursorOutput.show_cursor   r   r   c                    g)z-Set cursor shape to block, beam or underline.Nr   r   cursor_shapes     r   set_cursor_shapeOutput.set_cursor_shape   r   r   c                    g)zReset cursor shape.Nr   r   s    r   reset_cursor_shapeOutput.reset_cursor_shape   r   r   c                    g)z8
Asks for a cursor position report (CPR).
(VT100 only.)
Nr   r   s    r   ask_for_cprOutput.ask_for_cpr   r   r   c                    g)a  
`True` if the `Application` can expect to receive a CPR response after
calling `ask_for_cpr` (this will come back through the corresponding
`Input`).

This is used to determine the amount of available rows we have below
the cursor position. In the first place, we have this so that the drop
down autocompletion menus are sized according to the available space.

On Windows, we don't need this, there we have
`get_rows_below_cursor_position`.
Fr   r   s    r   responds_to_cprOutput.responds_to_cpr   s     r   c                    g)z%Return the size of the output window.Nr   r   s    r   get_sizeOutput.get_size   r   r   c                    g)zSound bell.Nr   r   s    r   bellOutput.bell   r   r   c                    gzFor vt100 only.Nr   r   s    r   enable_bracketed_pasteOutput.enable_bracketed_paste   r   r   c                    gr   r   r   s    r   disable_bracketed_pasteOutput.disable_bracketed_paste   r   r   c                    g)z
For vt100 only.
Put the terminal in normal cursor mode (instead of application mode).

See: https://vt100.net/docs/vt100-ug/chapter3.html
Nr   r   s    r   reset_cursor_key_modeOutput.reset_cursor_key_mode   r   r   c                    g)zFor Win32 only.Nr   r   s    r   scroll_buffer_to_promptOutput.scroll_buffer_to_prompt   r   r   c                    [         e)zFor Windows only.NotImplementedErrorr   s    r   get_rows_below_cursor_position%Output.get_rows_below_cursor_position       !!r   c                    g)a  
Get default color depth for this output.

This value will be used if no color depth was explicitly passed to the
`Application`.

.. note::

    If the `$PROMPT_TOOLKIT_COLOR_DEPTH` environment variable has been
    set, then `outputs.defaults.create_output` will pass this value to
    the implementation as the default_color_depth, which is returned
    here. (This is not used when the output corresponds to a
    prompt_toolkit SSH/Telnet session.)
Nr   r   s    r   get_default_color_depthOutput.get_default_color_depth   r   r   r   returnintr   strr    r   r   Noner(   r   r   r   r   r   rK   r
   rL   r   r   r   r   r   rW   r   rX   r   r   r   r]   r   r   r   rq   r   r   r   )r   boolr   r	   r   r   )/__name__
__module____qualname____firstlineno____doc__r   __annotations__r   r   r   r!   r$   r)   r,   r/   r2   r5   r8   r;   r>   rA   rD   rG   rM   rP   rS   rY   r^   ra   rd   rg   rj   rm   rr   ru   rx   propertyr{   r~   r   r   r   r   r   r   r   __static_attributes__r   r   r   r   r      s    !FM K K   J J     : : , ,   M M - -      
   . . 0 0 & & % %     ) ) + + . . / /     8 8     0 0"  r   )	metaclassc                  z   \ rS rSrSrS(S jrS)S jrS*S jrS*S jrS+S jr	S,S jr
S,S	 jrS,S
 jrS,S jrS,S jrS,S jrS,S jrS,S jrS,S jrS,S jrS-S jrS,S jrS,S jrS.S/S jjrS0S jrS0S jrS0S jrS0S jrS,S jrS,S jrS1S jrS,S jrS,S jr S,S jr!S,S  jr"S,S! jr#S,S" jr$S2S# jr%S(S$ jr&S3S% jr'S&r(g')4r      z<
For testing. An output class that doesn't render anything.
c                    [         e)z*There is no sensible default for fileno().r   r   s    r   r   DummyOutput.fileno   r   r   c                    g)Nzutf-8r   r   s    r   r   DummyOutput.encoding   s    r   c                    g Nr   r   s     r   r!   DummyOutput.write       r   c                    g r   r   r   s     r   r$   DummyOutput.write_raw   r   r   c                    g r   r   r'   s     r   r)   DummyOutput.set_title   r   r   c                    g r   r   r   s    r   r,   DummyOutput.clear_title   r   r   c                    g r   r   r   s    r   r/   DummyOutput.flush   r   r   c                    g r   r   r   s    r   r2   DummyOutput.erase_screen   r   r   c                    g r   r   r   s    r   r5   "DummyOutput.enter_alternate_screen   r   r   c                    g r   r   r   s    r   r8   !DummyOutput.quit_alternate_screen   r   r   c                    g r   r   r   s    r   r;    DummyOutput.enable_mouse_support  r   r   c                    g r   r   r   s    r   r>   !DummyOutput.disable_mouse_support  r   r   c                    g r   r   r   s    r   rA   DummyOutput.erase_end_of_line	  r   r   c                    g r   r   r   s    r   rD   DummyOutput.erase_down  r   r   c                    g r   r   r   s    r   rG   DummyOutput.reset_attributes  r   r   c                    g r   r   rJ   s      r   rM   DummyOutput.set_attributes  r   r   c                    g r   r   r   s    r   rP   DummyOutput.disable_autowrap  r   r   c                    g r   r   r   s    r   rS   DummyOutput.enable_autowrap  r   r   c                    g r   r   rV   s      r   rY   DummyOutput.cursor_goto  r   r   c                    g r   r   r\   s     r   r^   DummyOutput.cursor_up  r   r   c                    g r   r   r\   s     r   ra   DummyOutput.cursor_down!  r   r   c                    g r   r   r\   s     r   rd   DummyOutput.cursor_forward$  r   r   c                    g r   r   r\   s     r   rg   DummyOutput.cursor_backward'  r   r   c                    g r   r   r   s    r   rj   DummyOutput.hide_cursor*  r   r   c                    g r   r   r   s    r   rm   DummyOutput.show_cursor-  r   r   c                    g r   r   rp   s     r   rr   DummyOutput.set_cursor_shape0  r   r   c                    g r   r   r   s    r   ru   DummyOutput.reset_cursor_shape3  r   r   c                    g r   r   r   s    r   rx   DummyOutput.ask_for_cpr6  r   r   c                    g r   r   r   s    r   r   DummyOutput.bell9  r   r   c                    g r   r   r   s    r   r   "DummyOutput.enable_bracketed_paste<  r   r   c                    g r   r   r   s    r   r   #DummyOutput.disable_bracketed_paste?  r   r   c                    g r   r   r   s    r   r   #DummyOutput.scroll_buffer_to_promptB  r   r   c                    [        SSS9$ )N(   P   )rowscolumnsr   r   s    r   r~   DummyOutput.get_sizeE  s    R((r   c                    g)Nr   r   r   s    r   r   *DummyOutput.get_rows_below_cursor_positionH  s    r   c                "    [         R                  $ r   )r   DEPTH_1_BITr   s    r   r   #DummyOutput.get_default_color_depthK  s    %%%r   r   Nr   r   r   r   r   r   r   r   r   r   r   r   ))r   r   r   r   r   r   r   r!   r$   r)   r,   r/   r2   r5   r8   r;   r>   rA   rD   rG   rM   rP   rS   rY   r^   ra   rd   rg   rj   rm   rr   ru   rx   r   r   r   r   r~   r   r   r   r   r   r   r   r      s    ")&r   N)r   
__future__r   abcr   r   typingr   prompt_toolkit.cursor_shapesr   prompt_toolkit.data_structuresr	   prompt_toolkit.stylesr
   rL   r   __all__r   r   r   r   r   <module>r	     sM    # '  4 / ' # Fw FRm&& m&r   