MCPcopy Index your code
hub / github.com/python/cpython / insert_char

Method insert_char

Lib/getpass.py:293–302  ·  view source on GitHub ↗

Insert *char* at cursor position.

(self, char)

Source from the content-addressed store, hash-verified

291 self.stream.flush()
292
293 def insert_char(self, char):
294 """Insert *char* at cursor position."""
295 self.password.insert(self.cursor_pos, char)
296 self.cursor_pos += 1
297 # Only refresh if inserting in middle.
298 if self.cursor_pos < len(self.password):
299 self.refresh_display()
300 else:
301 self.stream.write(self.echo_char)
302 self.stream.flush()
303
304 def is_eol(self, char):
305 """Check if *char* is a line terminator."""

Callers 1

readlineMethod · 0.95

Calls 4

refresh_displayMethod · 0.95
insertMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected