code: def read(self, count=1024):
              # By default we choose a rather small chunk size, because reading
              # big amounts of input at once, causes the event loop to process
              # all these key bindings also at once without going back to the
              # loop. This will make the application feel unresponsive.
          
          if self.closed:
              return b''
  
          # Note: the following works better than wrapping `self.stdin` like
          #       `codecs.getreader('utf-8')(stdin)` and doing `read(1)`.
          #       Somehow that causes some latency when the escape
          #       character is pressed. (Especially on combination with the `select`.)
          try:
              data = os.read(self.stdin_fd, count)
  
              # Nothing more to read, stream is closed.
              if data == b'':
                  self.closed = True
                  return ''
          except OSError:
              # In case of SIGWINCH
              data = b''
  
          return self._stdin_decoder.decode(data)
docs: Read the input and return it as a string.
  
          Return the text. Note that this can return an empty string, even when
          the input stream was not yet closed. This means that something went
          wrong during the decoding.