1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-06 20:29:34 +00:00

Fix MPU status display from wrapping unexpectedly on some terminals.

The unexpected wrapping was caused by passing a multiline string to
Cmd.prompt.  Cmd in turn passes the prompt string to raw_input(),
which expects only a single line.
This commit is contained in:
Mike Naberezny 2012-11-20 11:12:07 -08:00
parent 8f284a8e58
commit ea56153573
3 changed files with 9 additions and 5 deletions

View File

@ -8,6 +8,9 @@
- Reformatted source code to comply with PEP8.
- Fixed a bug where the MPU status display would wrap unexpectedly
on some terminals.
0.13 (2012-11-15)
- Fixed a bug where negative numbers could be entered

View File

@ -44,5 +44,5 @@ class MPU(mpu6502.MPU):
disassemble = mpu6502.MPU.disassemble[:]
def reprformat(self):
return ("%s PC AC XR YR SP NV---------BDIZC\n" +
return ("%s PC AC XR YR SP NV---------BDIZC\n" +
"%s: %08x %04x %04x %04x %04x %s")

View File

@ -43,9 +43,10 @@ class Monitor(cmd.Cmd):
argv = sys.argv
self._reset(self.mpu_type)
self._width = 78
self._update_prompt()
self.prompt = "."
self._add_shortcuts()
cmd.Cmd.__init__(self, completekey, stdin, stdout)
self._output_mpu_status()
self._parse_args(argv)
def _parse_args(self, argv):
@ -109,7 +110,7 @@ class Monitor(cmd.Cmd):
error = 'Error: %s, %s: file: %s line: %s' % (t, v, file, line)
self._output(error)
self._update_prompt()
self._output_mpu_status()
return result
def _reset(self, mpu_type):
@ -211,8 +212,8 @@ class Monitor(cmd.Cmd):
self._mpu.memory = m
def _update_prompt(self):
self.prompt = "\n%s\n." % repr(self._mpu)
def _output_mpu_status(self):
self._output("\n" + repr(self._mpu))
def _output(self, stuff):
if stuff is not None: