| 184 | ) |
| 185 | |
| 186 | def after_command(self, cmd: Command) -> None: |
| 187 | super().after_command(cmd) |
| 188 | if self.more_lines is None: |
| 189 | # Force single-line input if we are in raw_input() mode. |
| 190 | # Although there is no direct way to add a \n in this mode, |
| 191 | # multiline buffers can still show up using various |
| 192 | # commands, e.g. navigating the history. |
| 193 | try: |
| 194 | index = self.buffer.index("\n") |
| 195 | except ValueError: |
| 196 | pass |
| 197 | else: |
| 198 | self.buffer = self.buffer[:index] |
| 199 | if self.pos > len(self.buffer): |
| 200 | self.pos = len(self.buffer) |
| 201 | |
| 202 | |
| 203 | def set_auto_history(_should_auto_add_history: bool) -> None: |