Index: package_branches/invirt-web/cherrypy/code/ajaxterm.py
===================================================================
--- package_branches/invirt-web/cherrypy/code/ajaxterm.py	(revision 2453)
+++ package_branches/invirt-web/cherrypy/code/ajaxterm.py	(revision 2454)
@@ -3,5 +3,5 @@
 """ Ajaxterm """
 
-import array,cgi,fcntl,glob,mimetypes,optparse,os,pty,random,re,signal,select,sys,threading,time,termios,struct,pwd
+import array,cgi,fcntl,glob,hashlib,mimetypes,optparse,os,pty,random,re,signal,select,sys,threading,time,termios,struct,pwd
 
 os.chdir(os.path.normpath(os.path.dirname(__file__)))
@@ -101,5 +101,4 @@
 		self.buf=""
 		self.outbuf=""
-		self.last_html=""
 	def peek(self,y1,x1,y2,x2):
 		return self.scr[self.width*y1+x1:self.width*y2+x2]
@@ -321,5 +320,5 @@
 	def dumplatin1(self):
 		return self.dump().translate(self.trl1)
-	def dumphtml(self,color=1,force=False):
+	def dumphtml(self,color=1,last_hash=None):
 		h=self.height
 		w=self.width
@@ -343,10 +342,9 @@
 			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 and not force:
+		hash = hashlib.md5(r).hexdigest()
+		r='<?xml version="1.0" encoding="ISO-8859-1"?><pre class="term" id="%s">%s</pre>'% (hash,r)
+		if last_hash == hash:
 			return '<?xml version="1.0"?><idem></idem>'
 		else:
-			self.last_html=r
-#			print self
 			return r
 	def __repr__(self):
@@ -437,7 +435,7 @@
 		except (IOError,OSError):
 			self.proc_kill(fd)
-	def dump(self,fd,color=1,force=False):
+	def dump(self,fd,color=1,last_hash=None):
 		try:
-			return self.proc[fd]['term'].dumphtml(color, force)
+			return self.proc[fd]['term'].dumphtml(color, last_hash)
 		except KeyError:
 			return False
Index: package_branches/invirt-web/cherrypy/code/main.py
===================================================================
--- package_branches/invirt-web/cherrypy/code/main.py	(revision 2453)
+++ package_branches/invirt-web/cherrypy/code/main.py	(revision 2454)
@@ -305,5 +305,5 @@
         @cherrypy.tools.require_POST()
         @cherrypy.tools.gzip()
-        def at(self, machine_id, k=None, c=0, force=0):
+        def at(self, machine_id, k=None, c=0, h=None):
             machine = validation.Validate(cherrypy.request.login, cherrypy.request.state, machine_id=machine_id).machine
             with self.atsessions_lock:
@@ -323,5 +323,5 @@
                     self.atmulti.proc_write(term,k)
                 time.sleep(0.002)
-                dump=self.atmulti.dump(term,c,int(force))
+                dump=self.atmulti.dump(term,c,h)
                 cherrypy.response.headers['Content-Type']='text/xml'
                 if isinstance(dump,str):
Index: package_branches/invirt-web/cherrypy/code/static/ajaxterm/ajaxterm.js
===================================================================
--- package_branches/invirt-web/cherrypy/code/static/ajaxterm/ajaxterm.js	(revision 2453)
+++ package_branches/invirt-web/cherrypy/code/static/ajaxterm/ajaxterm.js	(revision 2454)
@@ -13,5 +13,4 @@
 	var sending=0;
 	var rmax=1;
-	var force=true;
 
 	var div=document.getElementById(id);
@@ -99,7 +98,6 @@
 			}
 			var query=query1+send;
-			if (force) {
-			    query=query+"&force=1";
-			    force=false;
+			if (dterm.firstChild && dterm.firstChild.id) {
+			    query=query+"&h="+dterm.firstChild.id;
 			}
 			r.open("POST",base_path,true);
@@ -263,5 +261,4 @@
 		focus_element.onkeypress=keypress;
 		focus_element.onkeydown=keydown;
-		force=true;
 		timeout=window.setTimeout(update,100);
 	}
