From aa9728c004f996503e1bbdd3aaed5be071a6a445 Mon Sep 17 00:00:00 2001 From: Michael Herring Date: Sun, 24 Aug 2014 19:04:46 +0900 Subject: [PATCH 1/2] Better autodetection of Soft Tabs. Check for the presence of a space, instead of the absence of a tab. This ensures that Soft Tabs will not be activated on a file that (for example) starts with a BOM or something, but is otherwise full of hard tabs. --- src/editor.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor.coffee b/src/editor.coffee index 451e84b0c..2e8269ff9 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -354,7 +354,7 @@ class Editor extends Model for bufferRow in [0..@buffer.getLastRow()] continue if @displayBuffer.tokenizedBuffer.lineForScreenRow(bufferRow).isComment() if match = @buffer.lineForRow(bufferRow).match(/^\s/) - return match[0][0] != '\t' + return match[0][0] == ' ' undefined # Public: Clip the given {Point} to a valid position in the buffer. From 039e61e960b0ef39177e5f9382da972e42f34e43 Mon Sep 17 00:00:00 2001 From: Michael Herring Date: Thu, 28 Aug 2014 17:44:49 +0900 Subject: [PATCH 2/2] updated regex in usesSoftTabs to only look for Tab and Space --- src/editor.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor.coffee b/src/editor.coffee index 817fd60af..d5f0870b6 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -834,7 +834,7 @@ class Editor extends Model usesSoftTabs: -> for bufferRow in [0..@buffer.getLastRow()] continue if @displayBuffer.tokenizedBuffer.lineForScreenRow(bufferRow).isComment() - if match = @buffer.lineForRow(bufferRow).match(/^\s/) + if match = @buffer.lineForRow(bufferRow).match(/^[ \t]/) return match[0][0] == ' ' undefined