Prevent super/subscript from both being overridden
authorAryeh Gregor <AryehGregor+gitcommit@gmail.com>
Thu, 21 Jul 2011 15:28:41 -0600
changeset 439 d521738e127f
parent 438 ee56099364e6
child 440 2452d1c6d2f2
Prevent super/subscript from both being overridden
editcommands.html
implementation.js
source.html
tests.js
--- a/editcommands.html	Thu Jul 21 15:23:15 2011 -0600
+++ b/editcommands.html	Thu Jul 21 15:28:41 2011 -0600
@@ -2365,6 +2365,12 @@
       <li>underline: True if <var title="">new value</var> is "underline", false otherwise.
     </ul>
 
+    <li>If <var title="">command</var> is "subscript", unset the <a href=#state-override>state
+    override</a> for "superscript".
+
+    <li>If <var title="">command</var> is "superscript", unset the <a href=#state-override>state
+    override</a> for "subscript".
+
     <li>If <var title="">new value</var> is null, unset the <a href=#value-override>value override</a>
     (if any).
 
--- a/implementation.js	Thu Jul 21 15:23:15 2011 -0600
+++ b/implementation.js	Thu Jul 21 15:28:41 2011 -0600
@@ -2911,6 +2911,18 @@
 			case "underline": setStateOverride(command, newValue === "underline");
 		}
 
+		// "If command is "subscript", unset the state override for
+		// "superscript"."
+		if (command == "subscript") {
+			unsetStateOverride("superscript");
+		}
+
+		// "If command is "superscript", unset the state override for
+		// "subscript"."
+		if (command == "superscript") {
+			unsetStateOverride("subscript");
+		}
+
 		// "If new value is null, unset the value override (if any)."
 		if (newValue === null) {
 			unsetValueOverride(command);
--- a/source.html	Thu Jul 21 15:23:15 2011 -0600
+++ b/source.html	Thu Jul 21 15:28:41 2011 -0600
@@ -2350,6 +2350,12 @@
       <li>underline: True if <var>new value</var> is "underline", false otherwise.
     </ul>
 
+    <li>If <var>command</var> is "subscript", unset the <span>state
+    override</span> for "superscript".
+
+    <li>If <var>command</var> is "superscript", unset the <span>state
+    override</span> for "subscript".
+
     <li>If <var>new value</var> is null, unset the <span>value override</span>
     (if any).
 
--- a/tests.js	Thu Jul 21 15:23:15 2011 -0600
+++ b/tests.js	Thu Jul 21 15:28:41 2011 -0600
@@ -3307,10 +3307,8 @@
 		['foo[]bar', 'forecolor', ['inserttext', 'a']],
 		['foo[]bar', 'hilitecolor', ['inserttext', 'a']],
 
-		// Lots and lots of stuff in a row
-		['foo[]bar', 'bold', 'italic', 'strikethrough', 'subscript',
-		'superscript', 'underline', 'createlink', 'fontname', 'fontsize',
-		'forecolor', 'hilitecolor', ['inserttext', 'a']],
+		['foo[]bar', 'superscript', 'subscript', ['inserttext', 'a']],
+		['foo[]bar', 'subscript', 'superscript', ['inserttext', 'a']],
 	],
 	//@}
 };