Skip to content

Commit 82b71f8

Browse files
committed
Use the 'commands' state for '(com)' prompts
This prevents all multi-line editing, instead sending each line directly to the server so that it can decide when the command list is terminated.
1 parent f184e4e commit 82b71f8

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Lib/pdb.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2688,7 +2688,8 @@ def cmdloop(self, intro=None):
26882688

26892689
if not self.cmdqueue:
26902690
try:
2691-
reply = self._get_input(prompt=self.prompt, state="pdb")
2691+
state = "commands" if self.commands_defining else "pdb"
2692+
reply = self._get_input(prompt=self.prompt, state=state)
26922693
except EOFError:
26932694
reply = "EOF"
26942695

Lib/test/test_remote_pdb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ def test_registering_commands(self):
186186
outputs = self.sockfile.get_output()
187187
self.assertIn('command_list', outputs[0])
188188
self.assertEqual(outputs[1], {"prompt": "(Pdb) ", "state": "pdb"})
189-
self.assertEqual(outputs[2], {"prompt": "(com) ", "state": "pdb"})
190-
self.assertEqual(outputs[3], {"prompt": "(com) ", "state": "pdb"})
191-
self.assertEqual(outputs[4], {"prompt": "(com) ", "state": "pdb"})
189+
self.assertEqual(outputs[2], {"prompt": "(com) ", "state": "commands"})
190+
self.assertEqual(outputs[3], {"prompt": "(com) ", "state": "commands"})
191+
self.assertEqual(outputs[4], {"prompt": "(com) ", "state": "commands"})
192192
self.assertEqual(outputs[5], {"prompt": "(Pdb) ", "state": "pdb"})
193193
self.assertEqual(outputs[6], {"message": "\n", "type": "info"})
194194
self.assertEqual(len(outputs), 7)

0 commit comments

Comments
 (0)