[mw-devel] MW3 r1222 - in trunk/webclient: . templates

dez at sucs.org dez at sucs.org
Sun Oct 10 20:46:43 BST 2010


Author: dez
Date: 2010-10-10 20:46:43 +0100 (Sun, 10 Oct 2010)
New Revision: 1222

Modified:
   trunk/webclient/say.js
   trunk/webclient/templates/front.html
Log:
Resolves bug in which inserting an escape char with a keypress part-way along a line resulted in the rest of the line being highlighted


Modified: trunk/webclient/say.js
===================================================================
--- trunk/webclient/say.js	2010-10-10 18:51:29 UTC (rev 1221)
+++ trunk/webclient/say.js	2010-10-10 19:46:43 UTC (rev 1222)
@@ -118,7 +118,6 @@
 {
 	if (text.substr(0, 1)=="."||text.substr(0, 1)=="!"||text.substr(0, 1)=="/") {
 		cmdParser(text);
-		
 		return false;
 	}
 
@@ -254,14 +253,14 @@
 		sendSay(text);
 		return false;
 	case 27:
-		insertEscape();
+		insertEscape(false);
 		return false;
 	default:
 		return true;
 	}
 }
 
-function insertEscape() {
+function insertEscape(buttonpress) {
 var myField=document.getElementById("sayit");
 var myValue="\033";
   //IE support
@@ -278,10 +277,11 @@
                   + myValue
                   + myField.value.substring(endPos, myField.value.length);
     myField.selectionStart = startPos+1;
+    myField.selectionEnd = myField.selectionStart;
   } else {
     myField.value += myValue;
   }
-myField.focus();
+	if (buttonpress) myField.focus();
 }
 
 $(document).ready(function(){waitForMsg();});

Modified: trunk/webclient/templates/front.html
===================================================================
--- trunk/webclient/templates/front.html	2010-10-10 18:51:29 UTC (rev 1221)
+++ trunk/webclient/templates/front.html	2010-10-10 19:46:43 UTC (rev 1222)
@@ -11,12 +11,12 @@
 </td></tr>
 <tr><td style="height: 4em;">
 <form action="" id="sayform">
-	<textarea name="sayit" id="sayit" onKeyUp="return submitenter(this,event)"></textarea>
+	<textarea name="sayit" id="sayit" onKeyDown="return submitenter(this,event)"></textarea>
 </form>
 </td><td>
 <form action="{$self}" method="post" id="logoutform">
 	<input type="hidden" name="action" value="logout">
-	<input type="button" name="escape" value="Escape" onclick="insertEscape();"><br />
+	<input type="button" name="escape" value="Escape" onclick="insertEscape(true);"><br />
 	<input type="submit" name="submit" value="Logout" onclick="sendCmd('quit');">
 </form>
 </td></tr>




More information about the mw-devel mailing list