mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Detect softTabs/hardTabs when an EditSession is created
This commit is contained in:
@@ -352,6 +352,12 @@ class Buffer
|
||||
return row unless @isRowBlank(row)
|
||||
null
|
||||
|
||||
usesSoftTabs: ->
|
||||
for line in @getLines()
|
||||
if match = line.match(/^\s/)
|
||||
return match[0][0] != '\t'
|
||||
undefined
|
||||
|
||||
logLines: (start=0, end=@getLastRow())->
|
||||
for row in [start..end]
|
||||
line = @lineForRow(row)
|
||||
|
||||
@@ -39,9 +39,9 @@ class EditSession
|
||||
softTabs: true
|
||||
softWrap: false
|
||||
|
||||
constructor: ({@project, @buffer, @tabLength, @autoIndent, @softTabs, @softWrap }) ->
|
||||
constructor: ({@project, @buffer, @tabLength, @autoIndent, softTabs, @softWrap }) ->
|
||||
@id = @constructor.idCounter++
|
||||
@softTabs ?= true
|
||||
@softTabs = @buffer.usesSoftTabs() ? softTabs ? true
|
||||
@languageMode = new LanguageMode(this, @buffer.getExtension())
|
||||
@displayBuffer = new DisplayBuffer(@buffer, { @languageMode, @tabLength })
|
||||
@tokenizedBuffer = @displayBuffer.tokenizedBuffer
|
||||
|
||||
Reference in New Issue
Block a user