[pyrepl-checkins] r5443 - pyrepl/branch/pyrepl-rework-n/pyrepl
mwh at codespeak.net
mwh at codespeak.net
Mon Jul 5 17:37:03 MEST 2004
Author: mwh
Date: Mon Jul 5 17:37:02 2004
New Revision: 5443
Modified:
pyrepl/branch/pyrepl-rework-n/pyrepl/commands.py
pyrepl/branch/pyrepl-rework-n/pyrepl/keymap.py
pyrepl/branch/pyrepl-rework-n/pyrepl/unix_console.py
Log:
fixes -- arrow keys now work again
Modified: pyrepl/branch/pyrepl-rework-n/pyrepl/commands.py
==============================================================================
--- pyrepl/branch/pyrepl-rework-n/pyrepl/commands.py (original)
+++ pyrepl/branch/pyrepl-rework-n/pyrepl/commands.py Mon Jul 5 17:37:02 2004
@@ -347,7 +347,7 @@
class invalid_key(Command):
def do(self):
pending = self.reader.console.getpending()
- s = ''.join(self.event) + pending.data
+ s = ''.join([e.raw for e in self.event]) + pending.raw
self.reader.error("`%r' not bound"%s)
class invalid_command(Command):
Modified: pyrepl/branch/pyrepl-rework-n/pyrepl/keymap.py
==============================================================================
--- pyrepl/branch/pyrepl-rework-n/pyrepl/keymap.py (original)
+++ pyrepl/branch/pyrepl-rework-n/pyrepl/keymap.py Mon Jul 5 17:37:02 2004
@@ -120,7 +120,7 @@
raise KeySpecError, \
"unrecognised keyname `%s' at char %d of %s"%(
ret, s + 2, repr(key))
- ret = keys.translate(ret)
+ #ret = keys.translate(ret)
s = t + 1
else:
raise KeySpecError, \
Modified: pyrepl/branch/pyrepl-rework-n/pyrepl/unix_console.py
==============================================================================
--- pyrepl/branch/pyrepl-rework-n/pyrepl/unix_console.py (original)
+++ pyrepl/branch/pyrepl-rework-n/pyrepl/unix_console.py Mon Jul 5 17:37:02 2004
@@ -21,9 +21,10 @@
import signal, re, time, sys
from fcntl import ioctl
from pyrepl.fancy_termios import tcgetattr, tcsetattr
-from pyrepl.console import Console
+from pyrepl.console import Console, Keystroke
from pyrepl.dfa import unicodesm, keystrokesm
+
# there are arguments for changing this to "refresh"
SIGWINCH_EVENT = 'repaint'
@@ -141,6 +142,8 @@
self.unicodesm = unicodesm.unicodesm_for_encoding(encoding)
self.keystrokesm = keystrokesm.KeystrokeSM(None, self.keys)
self.unicodesm.parent = self.keystrokesm
+
+ print self.keystrokesm.k
self._bel = _my_getstr("bel")
self._civis = _my_getstr("civis", optional=1)
@@ -542,27 +545,26 @@
if FIONREAD:
def getpending(self):
- e = Event('key', '', '')
+ e = Keystroke('', '')
- while not self.event_queue.empty():
- e2 = self.event_queue.get()
- e.data += e2.data
- e.raw += e.raw
+ while 1:
+ e2 = self.keystrokesm.get()
+ if e2 is None:
+ break
+ e.raw += e2.raw
amount = struct.unpack(
"i", ioctl(self.input_fd, FIONREAD, "\0\0\0\0"))[0]
raw = unicode(os.read(self.input_fd, amount), self.encoding, 'replace')
- e.data += raw
e.raw += raw
return e
else:
def getpending(self):
- e = Event('key', '', '')
+ e = Keystroke('', '')
while not self.event_queue.empty():
e2 = self.event_queue.get()
- e.data += e2.data
- e.raw += e.raw
+ e.raw += e2.raw
amount = 10000
raw = unicode(os.read(self.input_fd, amount), self.encoding, 'replace')
More information about the pyrepl-checkins
mailing list