 
       it "contains the lines that are visible on screen, plus and minus the overdraw margin", ->
         presenter = new TextEditorPresenter(model: editor, clientHeight: 25, scrollTop: 50, lineHeight: 10, lineOverdrawMargin: 1)
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(3).id]).toBeUndefined()
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(4).id]).toBeDefined()
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(9).id]).toBeDefined()
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(10).id]).toBeUndefined()
+        expect(lineStateForScreenRow(presenter, 3)).toBeUndefined()
+        expect(lineStateForScreenRow(presenter, 4)).toBeDefined()
+        expect(lineStateForScreenRow(presenter, 9)).toBeDefined()
+        expect(lineStateForScreenRow(presenter, 10)).toBeUndefined()
 
       it "reports all lines as visible if no external ::clientHeight is assigned", ->
         presenter = new TextEditorPresenter(model: editor, scrollTop: 0, lineHeight: 10, lineOverdrawMargin: 1)
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(0).id]).toBeDefined()
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(12).id]).toBeDefined()
+        expect(lineStateForScreenRow(presenter, 0)).toBeDefined()
+        expect(lineStateForScreenRow(presenter, 12)).toBeDefined()
 
       it "includes the .endOfLineInvisibles in the line state if the editor.showInvisibles config option is true", ->
         editor.setText("hello\nworld\r\n")
         presenter = new TextEditorPresenter(model: editor, clientHeight: 25, clientWidth: 50, scrollTop: 0, baseCharacterWidth: 10, lineHeight: 10, lineOverdrawMargin: 0)
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(0).id].endOfLineInvisibles).toBeNull()
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(1).id].endOfLineInvisibles).toBeNull()
+        expect(lineStateForScreenRow(presenter, 0).endOfLineInvisibles).toBeNull()
+        expect(lineStateForScreenRow(presenter, 1).endOfLineInvisibles).toBeNull()
 
         atom.config.set('editor.showInvisibles', true)
         presenter = new TextEditorPresenter(model: editor, clientHeight: 25, clientWidth: 50, scrollTop: 0, baseCharacterWidth: 10, lineHeight: 10, lineOverdrawMargin: 0)
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(0).id].endOfLineInvisibles).toEqual [atom.config.get('editor.invisibles.eol')]
-        expect(presenter.state.content.lines[editor.tokenizedLineForScreenRow(1).id].endOfLineInvisibles).toEqual [atom.config.get('editor.invisibles.cr'), atom.config.get('editor.invisibles.eol')]
+        expect(lineStateForScreenRow(presenter, 0).endOfLineInvisibles).toEqual [atom.config.get('editor.invisibles.eol')]
+        expect(lineStateForScreenRow(presenter, 1).endOfLineInvisibles).toEqual [atom.config.get('editor.invisibles.cr'), atom.config.get('editor.invisibles.eol')]
 
       it "includes .decorationClasses in the line state", ->
         editor.decorateMarker(editor.markBufferRange([[4, 0], [6, 0]]), type: 'line', class: 'a')

          expect(presenter.state.content.indentGuidesVisible).toBe false

  describe "::state.content.lines", ->
    describe "on initialization", ->
      it "contains the lines that are visible on screen, plus the overdraw margin", ->
        presenter = new TextEditorPresenter(model: editor, clientHeight: 25, scrollTop: 0, lineHeight: 10, lineOverdrawMargin: 1)

        line0 = editor.tokenizedLineForScreenRow(0)
        expectValues presenter.state.content.lines[line0.id], {
          screenRow: 0
          text: line0.text
          tokens: line0.tokens

        }

        line11 = editor.tokenizedLineForScreenRow(11)
        expectValues lineStateForScreenRow(presenter, 11), {
          screenRow: 11
          text: line11.text
          tokens: line11.tokens
