anchor.diff:  -include("ee_doc_set.hrl").
   -include("ee_pubsub.hrl").
   
  --record(main_window, {window, status_bar}).
  +-record(main_window, {window, text_panel, text_cursor, status_bar}).
   -record(blink_caret, {state = on, timer}).
   -record(state, {win = #main_window{}, doc_set = #ee_doc_set{}, blink_caret = #blink_caret{}}).
   
  
positive.code: handle_cast(Msg, _State) ->
  	erlang:error({bad_cast, Msg}).
  
  handle_info(#ee_pubsub_message{message = {document_inserted, DocPid}}, #state{win = #main_window{window = Window}, doc_set = DocSet0} = State) ->
  	{ok, DocSet1} = ee_doc_set:add_focus_document_view(DocSet0, DocPid),
  	ee_document:add_subscriber(DocPid, self()),
  	{ok, Buffer} = ee_document:get_buffer(DocPid),
  	%% TODO: Look intoif this is efficient (looking up the doc view by pid again)
  	{ok, DocSet2} = ee_doc_set:update_document_view_buffer(DocSet1, DocPid, Buffer),
  	wxFrame:refresh(Window),
  	{noreply, State#state{doc_set = DocSet2}};
  handle_info(#ee_pubsub_message{message = {document_deleted, DocPid}}, #state{doc_set = DocSet0} = State) ->
  	{ok, DocSet1} = ee_doc_set:remove_document_view(DocSet0, DocPid),
  	{noreply, State#state{doc_set = DocSet1}};
  handle_info(#ee_pubsub_message{message = {buffer_update, Buffer}, publisher = DocPid}, #state{win = #main_window{window = Window}, doc_set = DocSet0} = State) ->
  	{ok, DocSet1} = ee_doc_set:update_document_view_buffer(DocSet0, DocPid, Buffer),
  	wxFrame:refresh(Window),
  	{noreply, State#state{doc_set = DocSet1}};
  handle_info(blink_caret, #state{win = #main_window{window = Window}, blink_caret = BlinkCaret0} = State) ->
  	BlinkCaret1 = blink_caret(BlinkCaret0),
  	wxFrame:refresh(Window),
  	{noreply, State#state{blink_caret = BlinkCaret1}};
  handle_info(timeout, State) ->
  	wx:new(),
  
negative.code: 	#blink_caret{state = BlinkCaretState} = BlinkCaret,
  	%% TODO: Encapsulate doc view in doc set API.
  	{reply, {Buffer, Caret, BlinkCaretState}, State};
  handle_call(#wx{event = #wxClose{}}, _From, #state{win = Window} = State) ->
  	destroy_window(Window),
  	init:stop(),
  	{reply, ok, State};
  handle_call(#wx{event = #wxKey{} = KeyEvent}, _From, #state{blink_caret = BlinkCaret0} = State0) ->
  