--- a/lexers/LexHaskell.cxx
+++ b/lexers/LexHaskell.cxx
@@ -597,7 +597,8 @@
          hs.lmode = LITERATE_BIRD;
       }
          // Preprocessor
-      else if (sc.atLineStart && sc.ch == '#' && options.cpp) {
+      else if (sc.atLineStart && sc.ch == '#' && options.cpp
+            && (!options.stylingWithinPreprocessor || sc.state == SCE_HA_DEFAULT)) {
          sc.SetState(SCE_HA_PREPROCESSOR);
          sc.Forward();
       }
@@ -960,7 +961,6 @@
          sc.Forward();
       }
    }
-   styler.SetLineState(lineCurrent, hs.ToLineState());
    sc.Complete();
 }