mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Pass tabText into EditSession explicitly on construction
This commit is contained in:
@@ -7,10 +7,14 @@ describe "EditSession", ->
|
||||
beforeEach ->
|
||||
fakeEditor =
|
||||
calcSoftWrapColumn: ->
|
||||
tabText: ' '
|
||||
|
||||
buffer = new Buffer(require.resolve('fixtures/sample.js'))
|
||||
editSession = new EditSession(editor: fakeEditor, buffer: buffer, autoIndent: false)
|
||||
editSession = new EditSession(
|
||||
editor: fakeEditor
|
||||
buffer: buffer
|
||||
tabText: ' '
|
||||
autoIndent: false
|
||||
)
|
||||
lineLengths = buffer.getLines().map (line) -> line.length
|
||||
|
||||
describe "cursor movement", ->
|
||||
|
||||
@@ -9,8 +9,7 @@ describe "Selection", ->
|
||||
buffer = new Buffer(require.resolve('fixtures/sample.js'))
|
||||
fakeEditor =
|
||||
calcSoftWrapColumn: ->
|
||||
tabText: ' '
|
||||
editSession = new EditSession(editor: fakeEditor, buffer: buffer)
|
||||
editSession = new EditSession(editor: fakeEditor, buffer: buffer, tabText: ' ')
|
||||
selection = editSession.getSelection()
|
||||
|
||||
describe ".deleteSelectedText()", ->
|
||||
|
||||
@@ -15,6 +15,7 @@ class EditSession
|
||||
session = new EditSession(
|
||||
editor: editor
|
||||
buffer: buffer
|
||||
tabText: editor.tabText
|
||||
autoIndent: editor.autoIndent
|
||||
softTabs: editor.softTabs
|
||||
)
|
||||
@@ -31,10 +32,9 @@ class EditSession
|
||||
autoIndent: true
|
||||
softTabs: true
|
||||
|
||||
constructor: ({@editor, @buffer, @autoIndent}) ->
|
||||
constructor: ({@editor, @buffer, @tabText, @autoIndent}) ->
|
||||
@id = @constructor.idCounter++
|
||||
@tabText = @editor.tabText
|
||||
@renderer = new Renderer(@buffer, { softWrapColumn: @editor.calcSoftWrapColumn(), tabText: @editor.tabText })
|
||||
@renderer = new Renderer(@buffer, { softWrapColumn: @editor.calcSoftWrapColumn(), tabText: @tabText })
|
||||
@cursors = []
|
||||
@selections = []
|
||||
@addCursorAtScreenPosition([0, 0])
|
||||
|
||||
@@ -354,7 +354,13 @@ class Editor extends View
|
||||
index = @editSessionIndexForBuffer(buffer)
|
||||
unless index?
|
||||
index = @editSessions.length
|
||||
@editSessions.push(new EditSession(editor: this, buffer: buffer, autoIndent: @autoIndent, softTabs: @softTabs))
|
||||
@editSessions.push(new EditSession(
|
||||
editor: this
|
||||
buffer: buffer
|
||||
tabText: @tabText
|
||||
autoIndent: @autoIndent
|
||||
softTabs: @softTabs
|
||||
))
|
||||
|
||||
@setActiveEditSessionIndex(index)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user