diff --git a/mode/stex/stex.js b/mode/stex/stex.js
index 14f6fcc3cb8364d2c7823103451610f769659df8..470c4f150f5b8e6dca91ea9e7c76feb4615ed5b7 100644
--- a/mode/stex/stex.js
+++ b/mode/stex/stex.js
@@ -128,10 +128,7 @@ CodeMirror.defineMode("stex", function() {
 
         var ch = source.next();
         if (ch == "%") {
-            // special case: % at end of its own line; stay in same state
-            if (!source.eol()) {
-              setState(state, inCComment);
-            }
+            source.skipToEnd();
             return "comment";
         }
         else if (ch == '}' || ch == ']') {
@@ -163,12 +160,6 @@ CodeMirror.defineMode("stex", function() {
         }
     }
 
-    function inCComment(source, state) {
-        source.skipToEnd();
-        setState(state, normal);
-        return "comment";
-    }
-
     function inMathMode(source, state, endModeSeq) {
         if (source.eatSpace()) {
             return null;
@@ -207,11 +198,8 @@ CodeMirror.defineMode("stex", function() {
             return "bracket";
         }
 
-        // eat comments here, because inCComment returns us to normal state!
         if (ch == "%") {
-            if (!source.eol()) {
-                source.skipToEnd();
-            }
+            source.skipToEnd();
             return "comment";
         }
         return "error";