| 195 | ) |
| 196 | |
| 197 | def after_command(self, cmd: Command) -> None: |
| 198 | super().after_command(cmd) |
| 199 | if self.more_lines is None: |
| 200 | # Force single-line input if we are in raw_input() mode. |
| 201 | # Although there is no direct way to add a \n in this mode, |
| 202 | # multiline buffers can still show up using various |
| 203 | # commands, e.g. navigating the history. |
| 204 | try: |
| 205 | index = self.buffer.index("\n") |
| 206 | except ValueError: |
| 207 | pass |
| 208 | else: |
| 209 | self.buffer = self.buffer[:index] |
| 210 | if self.pos > len(self.buffer): |
| 211 | self.pos = len(self.buffer) |
| 212 | |
| 213 | |
| 214 | def set_auto_history(_should_auto_add_history: bool) -> None: |