anchor.diff:  
               ColoredString(builder.ToString())
   
  -        let private UpdateHomeRow screenpos st = 
  +        let private updateHomeRow screenpos st = 
               let lines = 1 + (screenpos / Console.WindowWidth);
   
               { st with HomeRow = System.Math.Max (0, Console.CursorTop - (lines - 1)) }
   
  -        let private Render st =
  +        let private render st =
               st.ShownPrompt.WriteToConsole ()
               st.RenderedText.WriteToConsole()
   
  
positive.code:             
                  if i <> p then i else -1
  
          let private CmdBackwardWord st =
              let p = WordBackward st.Cursor st
              if p <> -1 then st |> UpdateCursor p else st
  
          let private CmdForwardWord st =
              let p = WordForward st.Cursor st
              if p <> -1 then st |> UpdateCursor p else st
  
          let private CmdRight st =
              if (st.Cursor <> st.Text.Length) then st |> UpdateCursor (st.Cursor+1) else st
  
          let private RenderAfter p st =
              let st = st |> ForceCursor p |> RenderFrom p
              st |> ForceCursor st.Cursor
          
          let private CmdBackspace st =
              if st.Cursor <> 0 then
                  let newCursor = st.Cursor - 1
                  let newText = st.Text.Remove (newCursor, 1)
                  let st = { st with Cursor = newCursor; Text = newText; RenderedText = render newText}
                  st |> RenderAfter newCursor
              else
                  st
  
          let private CmdDeleteChar st =
              if st.Text.Length = 0 then
                  Console.WriteLine ()
                  // If there is no input, this behaves like EOF
                  { st with DoneEditing = true; SignalExit = true }
              else if (st.Cursor <> st.Text.Length) then
                  let newText = st.Text.Remove (st.Cursor, 1)
                  let st = { st with Text = newText; RenderedText = render newText }
                  st |> RenderAfter st.Cursor
              else
                  st
              
          let private CmdDeleteWord st =
              let pos = st |> WordForward st.Cursor
  
              if pos <> -1 then
                  let k = st.Text.Substring (st.Cursor, pos-st.Cursor)
  
negative.code:             if (st.ShownPrompt.Length + st.RenderedText.Length) > st.MaxRendered then
                  { st with MaxRendered = st.ShownPrompt.Length + st.RenderedText.Length }
              else
                  let maxExtra = st.MaxRendered - st.ShownPrompt.Length
                  while i < maxExtra do
                      Console.Write (' ')
                      i <- i + 1
                  st
  
          let private insertChar (c:char) st =
              let prevLines = lineCount st
              let newText = st.Text.Insert (st.Cursor, (string)c)
              
              let st = { st with Text = newText; RenderedText = renderText newText }
                  
              if prevLines <> (lineCount st) then
                  Console.SetCursorPosition (0, st.HomeRow)
                  let newCursor = st.Cursor + 1
                  st
                      |> render
                      |> forceCursor newCursor
              else 
                  let newCursor = st.Cursor + 1
                  st
                      |> renderFrom st.Cursor
                      |> forceCursor newCursor
                      |> updateHomeRow (textToScreenPos newCursor st)
  
          let private insertTextAtCursor str st =
              let prevLines = st |> lineCount;
              let newText = st.Text.Insert (st.Cursor, str)
              let st = { st with Text = newText; RenderedText = renderText newText}
              if prevLines <> (lineCount st) then
                  Console.SetCursorPosition (0, st.HomeRow)
                  st |> render |> forceCursor (st.Cursor + str.Length)
              else
                  let st = st |> renderFrom st.Cursor |> forceCursor (st.Cursor + str.Length)
                  st |> updateHomeRow (textToScreenPos st.Cursor st)
  
          let private initText (initial:string option) st =
              let newText = match initial with | Some(null) | None -> "" | Some(initial) -> initial
              { st with Cursor = newText.Length; Text = newText; RenderedText = renderText newText }
                  |> render 
                  |> forceCursor newText.Length
  
          let private setText newtext st =
              Console.SetCursorPosition (0, st.HomeRow)
              st |> initText (newtext)
  
          let private setPromptCore newprompt st =
              Console.SetCursorPosition (0, st.HomeRow)
              { st with ShownPrompt = newprompt }
                  |> render
                  |> forceCursor st.Cursor
  
          let private setPrompt newprompt st =
              st |> setPromptCore newprompt
  
          let private setSearchPrompt s st =
              let promptRaw = sprintf "^[DarkGray](^[Cyan]reverse-i-search^[DarkGray])`^[Reset]%s^[DarkGray]': " s
              st |> setPromptCore (ColoredString promptRaw)
  
          //
          // Adds the current line to the history if needed
          //
          let private historyUpdateLine st =
              let newHistory = st.History |> History.update st.Text
              { st with History = newHistory }
  
          let rec private reverseSearch st =
              match st.SearchState with
              | Some(search) ->
                  let mutable p = -1
  