77from prompt_toolkit .eventloop import Future , From , ensure_future , get_event_loop
88from prompt_toolkit .filters import to_filter
99from prompt_toolkit .formatted_text import to_formatted_text
10+ from prompt_toolkit .input .base import Input
1011from prompt_toolkit .layout .mouse_handlers import MouseHandlers
1112from prompt_toolkit .layout .screen import Point , Screen , WritePosition
1213from prompt_toolkit .output import Output , ColorDepth
@@ -265,13 +266,17 @@ class Renderer(object):
265266 """
266267 CPR_TIMEOUT = 2 # Time to wait until we consider CPR to be not supported.
267268
268- def __init__ (self , style , output , full_screen = False , mouse_support = False , cpr_not_supported_callback = None ):
269+ def __init__ (self , style , output , input , full_screen = False ,
270+ mouse_support = False , cpr_not_supported_callback = None ):
271+
269272 assert isinstance (style , BaseStyle )
270273 assert isinstance (output , Output )
274+ assert isinstance (input , Input )
271275 assert callable (cpr_not_supported_callback ) or cpr_not_supported_callback is None
272276
273277 self .style = style
274278 self .output = output
279+ self .input = input
275280 self .full_screen = full_screen
276281 self .mouse_support = to_filter (mouse_support )
277282 self .cpr_not_supported_callback = cpr_not_supported_callback
@@ -283,6 +288,8 @@ def __init__(self, style, output, full_screen=False, mouse_support=False, cpr_no
283288 # Future set when we are waiting for a CPR flag.
284289 self ._waiting_for_cpr_futures = deque ()
285290 self .cpr_support = CPR_Support .UNKNOWN
291+ if not input .responds_to_cpr :
292+ self .cpr_support = CPR_Support .NOT_SUPPORTED
286293
287294 # Cache for the style.
288295 self ._attrs_for_style = None
0 commit comments