U
    ^g
                     @   sV   d dl mZmZmZmZ d dlmZmZ d dlm	Z	m
Z
mZ ee eddddZdS )    )IterableSequenceTuplecast)LegacyWindowsTermWindowsCoordinates)ControlCodeControlTypeSegmentN)buffertermreturnc                 C   s  | D ]\}}}|s2|r&| || n
|| q|}|D ]}|d }|tjkrtttttf |\}}	}
|t|
d |	d d q:|tj	kr|d q:|tj
kr|tdd q:|tjkr|  q:|tjkr|  q:|tjk r|  q:|tjkr|  q:|tjkr@ttttf |\}}||d  q:|tjkrV|  q:|tjkrl|  q:|tjkrttttf |\}}|dkr|  n&|dkr|  n|dkr|  q:|tjkr:ttttf |\}}|| q:qdS )a   Makes appropriate Windows Console API calls based on the segments in the buffer.

    Args:
        buffer (Iterable[Segment]): Iterable of Segments to convert to Win32 API calls.
        term (LegacyWindowsTerm): Used to call the Windows Console API.
    r      )rowcol   N) Zwrite_styled
write_textr	   ZCURSOR_MOVE_TOr   r   intZmove_cursor_tor   ZCARRIAGE_RETURNHOMEZ	CURSOR_UPZmove_cursor_upZCURSOR_DOWNZmove_cursor_downZCURSOR_FORWARDZmove_cursor_forwardZCURSOR_BACKWARDZmove_cursor_backwardZCURSOR_MOVE_TO_COLUMNZmove_cursor_to_columnHIDE_CURSORhide_cursorSHOW_CURSORZshow_cursorZERASE_IN_LINEZerase_end_of_lineZerase_start_of_line
erase_lineZSET_WINDOW_TITLEstr	set_title)r   r   textstylecontrolZcontrol_codesZcontrol_codeZcontrol_type_xycolumnmodetitle r%   :/tmp/pip-unpacked-wheel-04vb07gv/rich/_windows_renderer.pylegacy_windows_render   sR    


















r'   )typingr   r   r   r   Zrich._win32_consoler   r   Zrich.segmentr   r	   r
   r'   r%   r%   r%   r&   <module>   s   