mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Normalize all tabs, not just the first one
Refs atom/language-javascript#10
This commit is contained in:
@@ -2866,3 +2866,19 @@ describe "Editor", ->
|
||||
{tokens} = editor.lineForScreenRow(0)
|
||||
expect(tokens[2].value).toBe "SELECT"
|
||||
expect(tokens[2].scopes).toEqual ["source.js", "comment.line.double-slash.js", "keyword.other.DML.sql"]
|
||||
|
||||
describe ".normalizeTabsInBufferRange()", ->
|
||||
fit "normalizes tabs depending on the editor's soft tab/tab length settings", ->
|
||||
editor.setTabLength(1)
|
||||
editor.setSoftTabs(true)
|
||||
editor.setText('\t\t\t')
|
||||
editor.normalizeTabsInBufferRange([[0, 0], [0, 1]])
|
||||
expect(editor.getText()).toBe ' \t\t'
|
||||
|
||||
editor.setTabLength(2)
|
||||
editor.normalizeTabsInBufferRange([[0, 0], [Infinity, Infinity]])
|
||||
expect(editor.getText()).toBe ' '
|
||||
|
||||
editor.setSoftTabs(false)
|
||||
editor.normalizeTabsInBufferRange([[0, 0], [Infinity, Infinity]])
|
||||
expect(editor.getText()).toBe ' '
|
||||
|
||||
@@ -679,7 +679,7 @@ class Editor extends Model
|
||||
# {Range}.
|
||||
normalizeTabsInBufferRange: (bufferRange) ->
|
||||
return unless @getSoftTabs()
|
||||
@scanInBufferRange /\t/, bufferRange, ({replace}) => replace(@getTabText())
|
||||
@scanInBufferRange /\t/g, bufferRange, ({replace}) => replace(@getTabText())
|
||||
|
||||
# Public: For each selection, if the selection is empty, cut all characters
|
||||
# of the containing line following the cursor. Otherwise cut the selected
|
||||
|
||||
Reference in New Issue
Block a user