@@ -118,9 +118,12 @@ def __init__(self):
118118
119119 def register (self , fd , flag ):
120120 self .fd = fd
121-
122- def poll (self ): # note: a 'timeout' argument would be *milliseconds*
123- r , w , e = select .select ([self .fd ], [], [])
121+ # note: The 'timeout' argument is received as *milliseconds*
122+ def poll (self , timeout : float | None = None ) -> list [int ]:
123+ if timeout is None :
124+ r , w , e = select .select ([self .fd ], [], [])
125+ else :
126+ r , w , e = select .select ([self .fd ], [], [], timeout / 1000 )
124127 return r
125128
126129 poll = MinimalPoll # type: ignore[assignment]
@@ -385,11 +388,11 @@ def get_event(self, block: bool = True) -> Event | None:
385388 break
386389 return self .event_queue .get ()
387390
388- def wait (self ) :
391+ def wait (self , timeout : float | None = None ) -> bool :
389392 """
390393 Wait for events on the console.
391394 """
392- self .pollob .poll ()
395+ return bool ( self .pollob .poll (timeout ) )
393396
394397 def set_cursor_vis (self , visible ):
395398 """
@@ -527,6 +530,15 @@ def clear(self):
527530 self .__posxy = 0 , 0
528531 self .screen = []
529532
533+ @property
534+ def input_hook (self ):
535+ try :
536+ import posix
537+ except ImportError :
538+ return None
539+ if posix ._is_inputhook_installed ():
540+ return posix ._inputhook
541+
530542 def __enable_bracketed_paste (self ) -> None :
531543 os .write (self .output_fd , b"\x1b [?2004h" )
532544
0 commit comments