anchor.diff:                  x.InitText (newtext)
   
               member private x.SetPrompt newprompt =
  -                st.ShownPrompt <- newprompt
  +                st <- { st with ShownPrompt = newprompt }
                   Console.SetCursorPosition (0, st.HomeRow)
                   x.Render ()
                   x.ForceCursor st.Cursor
          
               member public x.Edit prompt initial =
  -                edit_thread <- Thread.CurrentThread
  -                searchState <- None
  +                st <-
  +                    {
  +                        st with
  +                            EditThread = Thread.CurrentThread
  +                            SearchState = None
  +                            DoneEditing = false
  +                            History = st.History |> History.cursorToEnd |> History.append initial
  +                            MaxRendered = 0
  +                            SpecifiedPrompt = prompt
  +                            ShownPrompt = prompt
  +                    }
  +
                   let cancelHandler = new ConsoleCancelEventHandler(x.InterruptEdit)
                   Console.CancelKeyPress.AddHandler cancelHandler
  -            
  -                done_editing <- false
  -                state <- { state with History = state.History |> History.cursorToEnd |> History.append initial }
  -                st.MaxRendered <- 0
  -            
  -                specified_prompt <- prompt
  -                st.ShownPrompt <- prompt;
  +
                   x.InitText (Some(initial))
   
  -                while not done_editing do
  +                while not st.DoneEditing do
                       try
                           x.EditLoop ()
                       with
                       | :? ThreadAbortException ->
  -                        searchState <- None
  +                        st <- { st with SearchState = None }
                           Thread.ResetAbort ()
                           Console.WriteLine ()
                           x.SetPrompt (prompt)
  
positive.code:                     failwith "No search in progress"
  
              member private x.CmdReverseSearch () =
                  match searchState with
                  | None ->
                      searchState <- Some { MatchAt = -1; Term = ""; Direction = SearchDirection.Backward}
                      x.SetSearchPrompt ("")
                  | Some(search) ->
                      if search.Term = "" then
                          match previousSearch with
                          | None | Some("") ->
                              ()
                          | Some(previousTerm) -> 
                              searchState <- Some { search with Term = previousTerm}
                              x.SetSearchPrompt previousTerm
                              x.ReverseSearch ()
                      else
  
negative.code:                         // The cursor is at the end of the string
                          let p = st.Text.LastIndexOf (search.Term)
                          if p <> -1 then
                              st <- { st with SearchState = Some({ search with MatchAt = p }); Cursor = p }
                              x.ForceCursor st.Cursor
                              search_backward <- false
                      else
  