]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
add ctrl-U and ctrl-H handling to our form of Manhole
authorBrian Warner <warner@lothar.com>
Fri, 1 Dec 2006 02:45:43 +0000 (19:45 -0700)
committerBrian Warner <warner@lothar.com>
Fri, 1 Dec 2006 02:45:43 +0000 (19:45 -0700)
allmydata/manhole.py

index 1fbfd3213e635fb2ed4a50dbd05d9dfb215b2c47..dfc7af3f8c7b5b40f6b25db6b7a4a130602ff6ec 100644 (file)
@@ -78,6 +78,16 @@ class AuthorizedKeysChecker(conchc.SSHPublicKeyDatabase):
                 continue
         return 0
 
+class ModifiedColoredManhole(manhole.ColoredManhole):
+    def connectionMade(self):
+        manhole.ColoredManhole.connectionMade(self)
+        self.keyHandlers["\x08"] = self.handle_DELETE
+        self.keyHandlers["\x15"] = self.handle_KILLLINE
+
+    def handle_KILLLINE(self):
+        self.handle_END()
+        for i in range(len(self.lineBuffer)):
+            self.handle_BACKSPACE()
 
 class _BaseManhole(service.MultiService):
     """This provides remote access to a python interpreter (a read/exec/print
@@ -130,7 +140,7 @@ class _BaseManhole(service.MultiService):
 
         def makeProtocol():
             namespace = makeNamespace()
-            p = insults.ServerProtocol(manhole.ColoredManhole, namespace)
+            p = insults.ServerProtocol(ModifiedColoredManhole, namespace)
             return p
 
         self.using_ssh = using_ssh