Erase previous word (Ctrl+W).
(self)
| 343 | self.refresh_display(prev_len) |
| 344 | |
| 345 | def handle_erase_word(self): |
| 346 | """Erase previous word (Ctrl+W).""" |
| 347 | old_cursor = self.cursor_pos |
| 348 | # Calculate the starting position of the previous word, |
| 349 | # ignoring trailing whitespaces. |
| 350 | while self.cursor_pos > 0 and self.password[self.cursor_pos - 1] == ' ': |
| 351 | self.cursor_pos -= 1 |
| 352 | while self.cursor_pos > 0 and self.password[self.cursor_pos - 1] != ' ': |
| 353 | self.cursor_pos -= 1 |
| 354 | # Delete the previous word and refresh the screen. |
| 355 | prev_len = len(self.password) |
| 356 | del self.password[self.cursor_pos:old_cursor] |
| 357 | self.refresh_display(prev_len) |
| 358 | |
| 359 | def handle_literal_next(self): |
| 360 | """State transition to indicate that the next character is literal.""" |
nothing calls this directly
no test coverage detected