diff --git a/spec/app/status-bar-spec.coffee b/spec/app/status-bar-spec.coffee index d625def9a..9e9c3dffe 100644 --- a/spec/app/status-bar-spec.coffee +++ b/spec/app/status-bar-spec.coffee @@ -125,11 +125,14 @@ describe "StatusBar", -> beforeEach -> path = require.resolve('fixtures/git/working-dir/file.txt') + newPath = fs.join(require.resolve('fixtures/git/working-dir'), 'new.txt') + fs.write(newPath, "I'm new here") originalPathText = fs.read(path) rootView.attachToDom() afterEach -> fs.write(path, originalPathText) + fs.remove(newPath) if fs.exists(newPath) it "displays the modified icon for a changed file", -> fs.write(path, "i've changed for the worse") @@ -139,3 +142,7 @@ describe "StatusBar", -> it "doesn't display the modified icon for an unchanged file", -> rootView.open(path) expect(statusBar.gitStatusIcon).toBeHidden() + + it "displays the new icon for a new file", -> + rootView.open(newPath) + expect(statusBar.gitStatusIcon).toBeVisible() diff --git a/src/app/status-bar.coffee b/src/app/status-bar.coffee index 2f1f2266d..430f821ed 100644 --- a/src/app/status-bar.coffee +++ b/src/app/status-bar.coffee @@ -1,5 +1,5 @@ -{View} = require 'space-pen' _ = require 'underscore' +{View, $$} = require 'space-pen' Git = require 'git' module.exports = @@ -20,7 +20,7 @@ class StatusBar extends View @content: -> @div class: 'status-bar', => @div class: 'file-info', => - @span '\uf252', class: 'octicons git-status', outlet: 'gitStatusIcon' + @span class: 'octicons git-status', outlet: 'gitStatusIcon' @span class: 'current-path', outlet: 'currentPath' @span class: 'buffer-modified', outlet: 'bufferModified' @div class: 'cursor-position', => @@ -71,13 +71,17 @@ class StatusBar extends View @branchArea.hide() updateStatusText: -> - if path = @editor.getPath() - modified = new Git(path).isPathModified(path) + @gitStatusIcon.empty().hide() + path = @editor.getPath() + return unless path - if modified + git = new Git(path) + if git.isPathModified(path) + @gitStatusIcon.append $$ -> @span '\uf26d', class: 'modified-status-icon' + @gitStatusIcon.show() + else if git.isPathNew(path) + @gitStatusIcon.append $$ -> @span '\uf26b', class: 'new-status-icon' @gitStatusIcon.show() - else - @gitStatusIcon.hide() updatePathText: -> if path = @editor.getPath() diff --git a/static/status-bar.css b/static/status-bar.css index a9909617d..307138d90 100644 --- a/static/status-bar.css +++ b/static/status-bar.css @@ -16,8 +16,12 @@ top: 5px; } -.status-bar .file-info .git-status { - color: #FAF05C; +.status-bar .file-info .modified-status-icon { + color: #6C6912; +} + +.status-bar .file-info .new-status-icon { + color: #269F81; } .status-bar .octicons { @@ -25,7 +29,7 @@ font-size: 14px; width: 14px; height: 14px; - padding-right: 2px; + padding-right: 5px; } .status-bar .branch-label {