Allow reconnecting to the same terminal session
[invirt/packages/invirt-web.git] / code / ajaxterm.py
index dd7e5b8..8436914 100644 (file)
@@ -320,7 +320,7 @@ class Terminal:
                return r
        def dumplatin1(self):
                return self.dump().translate(self.trl1)
-       def dumphtml(self,color=1):
+       def dumphtml(self,color=1,force=False):
                h=self.height
                w=self.width
                r=""
@@ -343,7 +343,7 @@ class Terminal:
                        if i%w==w-1:
                                span+='\n'
                r='<?xml version="1.0" encoding="ISO-8859-1"?><pre class="term">%s</pre>'%r
-               if self.last_html==r:
+               if self.last_html==r and not force:
                        return '<?xml version="1.0"?><idem></idem>'
                else:
                        self.last_html=r
@@ -436,9 +436,9 @@ class Multiplex:
                        os.write(fd,s)
                except (IOError,OSError):
                        self.proc_kill(fd)
-       def dump(self,fd,color=1):
+       def dump(self,fd,color=1,force=False):
                try:
-                       return self.proc[fd]['term'].dumphtml(color)
+                       return self.proc[fd]['term'].dumphtml(color, force)
                except KeyError:
                        return False
        def loop(self):