anchor.diff:      let mutable end' = x.InputLineEnd
       buffer.Delete (&start, &end')
   
  -  let highlightLine line state =
  -    let tokens = getTokensForLine "temp.fsx" None line state
  +  let (|Keyword|_|) t =
  +    match t.ColorClass with FSharpTokenColorKind.Keyword -> Some(t) | _ -> None
  +    
  +  let (|Identifier|_|) t =
  +    match t.ColorClass with FSharpTokenColorKind.Identifier -> Some(t) | _ -> None
  +    
  +  let (|UpperIdentifier|_|) t =
  +    match t.ColorClass with FSharpTokenColorKind.UpperIdentifier -> Some(t) | _ -> None
  +    
  +  let (|Comment|_|) t =
  +    match t.ColorClass with FSharpTokenColorKind.Comment -> Some(t) | _ -> None
  +    
  +  let (|String|_|) (t:FSharpTokenInfo) =
  +    match t.ColorClass with
  +    | FSharpTokenColorKind.String 
  +    | FSharpTokenColorKind.Text when not (t.CharClass = FSharpTokenCharKind.Delimiter || t.CharClass = FSharpTokenCharKind.Operator) -> Some(t)
  +    | _ -> None
  +    
  +  let (|InactiveCode|_|) t =
  +    match t.ColorClass with FSharpTokenColorKind.InactiveCode -> Some(t) | _ -> None
  +    
  +  let (|Number|_|) t =
  +    match t.ColorClass with FSharpTokenColorKind.Number -> Some(t) | _ -> None
  +    
  +  let (|Operator|_|) t =
  +    match t.ColorClass, t.CharClass with
  +    | FSharpTokenColorKind.Operator, _ -> Some(t)
  +    | _, FSharpTokenCharKind.Delimiter
  +    | _, FSharpTokenCharKind.Operator -> Some(t)
  +    | _ -> None
  +    
  +  let (|Preprocessor|_|) t =
  +    match t.ColorClass with FSharpTokenColorKind.PreprocessorKeyword -> Some(t) | _ -> None
  +
  +  let highlightLine (line:string) state =
  +    let tokens =
  +      if line.StartsWith("#") && line.Length > 1 && not (line.StartsWith("#r")) then
  +        [  yield TokeniserOutput.PlainHash
  +           yield! getTokensForLine "temp.fsx" None line.[1..] state ]
  +      else getTokensForLine "temp.fsx" None line state
       tokens |> 
       List.fold (fun state t ->
                  match t with
                  | Token( t,txt) ->
  -                   match t.ColorClass with
  -                   | FSharpTokenColorKind.Keyword -> applyToken txt tags.[Keyword]; state
  -                   | FSharpTokenColorKind.Identifier -> applyToken txt tags.[User]; state
  -                   | FSharpTokenColorKind.UpperIdentifier -> applyToken txt tags.[User]; state
  -                   | FSharpTokenColorKind.Comment -> applyToken txt tags.[Comment]; state
  -                   | FSharpTokenColorKind.String -> applyToken txt tags.[String]; state
  -                   | FSharpTokenColorKind.Text -> applyToken txt tags.[String]; state
  -                   | FSharpTokenColorKind.InactiveCode -> applyToken txt tags.[Inactive]; state
  -                   | FSharpTokenColorKind.Number -> applyToken txt tags.[Number]; state
  -                   | FSharpTokenColorKind.Operator -> applyToken txt tags.[Operator]; state
  -                   | FSharpTokenColorKind.PreprocessorKeyword -> applyToken txt tags.[Preprocessor]; state
  -                   | FSharpTokenColorKind.Default
  +                   match t with
  +                   | Keyword _-> applyToken txt tags.[Keyword]; state
  +                   | Identifier _-> applyToken txt tags.[User]; state
  +                   | UpperIdentifier _-> applyToken txt tags.[User]; state
  +                   | Comment _-> applyToken txt tags.[Comment]; state
  +                   | String _-> applyToken txt tags.[String]; state
  +                   | InactiveCode _-> applyToken txt tags.[Inactive]; state
  +                   | Number _-> applyToken txt tags.[Number]; state
  +                   | Operator _-> applyToken txt tags.[Operator]; state
  +                   | Preprocessor _-> applyToken txt tags.[Preprocessor]; state
                      | _ -> applyToken txt tags.[PlainText]; state
                  | EndState state -> state) 0L
     
  
positive.code:       | _ ->
          //do our syntax highlighting
          using (startInputProcessing()) (fun _ ->
          let nextKey = char (Gdk.Keyval.ToUnicode(args.Event.KeyValue))
          let line = x.InputLine + nextKey.ToString()
          eraseCurrentLine()
          let lines = line.Split([|'\n'|], StringSplitOptions.None)
          if lines.Length = 1 then tempState <- highlightLine line lastLineState
  
negative.code: 
    let addDisposable =
      disposables.Add
  
    let updateColors() =
      let addTag (k:Tags) v = 
  