From b0706ee9fbc9909d189454f297553bd50cfc3a23 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 Mar 2013 10:06:41 -0400 Subject: [PATCH 01/24] Update coffee cache path used in clean task --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 3f3c926eb..53c25b734 100644 --- a/Rakefile +++ b/Rakefile @@ -84,7 +84,7 @@ task :clean do output = `xcodebuild clean` `rm -rf #{application_path()}` `rm -rf #{BUILD_DIR}` - `rm -rf /tmp/atom-compiled-scripts` + `rm -rf /tmp/atom-coffee-cache` `rm -rf node_modules` `rm -rf cef` end From f51102a2305a43e33e8452c6903c44e7bf5dee3e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 Mar 2013 10:09:23 -0400 Subject: [PATCH 02/24] Don't force clean installs Making clean a pre-req install forces a reinstall and rebuild of all npm modules and reinstall of cef which drastically increases the install time even for small local changes. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 53c25b734..f4fa7f69e 100644 --- a/Rakefile +++ b/Rakefile @@ -41,7 +41,7 @@ task "bootstrap" do end desc "Copies Atom.app to /Applications and creates `atom` cli app" -task :install => [:clean, :build] do +task :install => [:build] do path = application_path() exit 1 if not path From aab50d3c2c5e6bc48d17ceecc6466444cdf2d855 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Thu, 28 Mar 2013 17:14:45 -0700 Subject: [PATCH 03/24] Only parse the first 100 tokens of a line This fixes the UI thread lockup when there is a gigantic line in a file (like minified js). I took a stab at making line tokeninization async on the atom/async-single-line-tokenization branch, but it was still too slow. Closes #150 --- spec/app/text-mate-grammar-spec.coffee | 10 ++++++++++ src/app/text-mate-grammar.coffee | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/spec/app/text-mate-grammar-spec.coffee b/spec/app/text-mate-grammar-spec.coffee index 276a96496..526717617 100644 --- a/spec/app/text-mate-grammar-spec.coffee +++ b/spec/app/text-mate-grammar-spec.coffee @@ -298,3 +298,13 @@ describe "TextMateGrammar", -> grammar = syntax.selectGrammar("style.scss") {tokens} = grammar.tokenizeLine("@mixin x() { -moz-selector: whatever; }") expect(tokens[9]).toEqual value: "-moz-selector", scopes: ["source.css.scss", "meta.property-list.scss", "meta.property-name.scss"] + + describe "when a line has more tokens than `maxTokensPerLine`", -> + it "creates a final token with the remaining text and resets the ruleStack to match the begining of the line", -> + grammar = syntax.selectGrammar("hello.js") + grammar.maxTokensPerLine = 5 + originalRuleStack = [grammar.initialRule, grammar.initialRule, grammar.initialRule] + {tokens, ruleStack} = grammar.tokenizeLine("one(two(three(four(five(_param_)))))", originalRuleStack) + expect(tokens.length).toBe 5 + expect(tokens[4].value).toBe "three(four(five(_param_)))))" + expect(ruleStack).toEqual originalRuleStack \ No newline at end of file diff --git a/src/app/text-mate-grammar.coffee b/src/app/text-mate-grammar.coffee index 93fe9559f..485fd668e 100644 --- a/src/app/text-mate-grammar.coffee +++ b/src/app/text-mate-grammar.coffee @@ -26,6 +26,7 @@ class TextMateGrammar repository: null initialRule: null firstLineRegex: null + maxTokensPerLine: 100 constructor: ({ @name, @fileTypes, @scopeName, patterns, repository, @foldingStopMarker, firstLineMatch}) -> @initialRule = new Rule(this, {@scopeName, patterns}) @@ -38,6 +39,7 @@ class TextMateGrammar @repository[name] = new Rule(this, data) tokenizeLine: (line, ruleStack=[@initialRule], firstLine=false) -> + originalRuleStack = ruleStack ruleStack = new Array(ruleStack...) # clone ruleStack tokens = [] position = 0 @@ -46,6 +48,12 @@ class TextMateGrammar previousRuleStackLength = ruleStack.length previousPosition = position + if tokens.length >= (@maxTokensPerLine - 1) + token = new Token(value: line[position..], scopes: scopes) + tokens.push token + ruleStack = originalRuleStack + break + if line.length == 0 tokens = [new Token(value: "", scopes: scopes)] return { tokens, ruleStack } From bd48cfced0ec4536ff0e25e2eb0cc33eaf7133fc Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 Mar 2013 22:06:56 -0400 Subject: [PATCH 04/24] Don't track ctrl-click as the start of a selection Closes #396 --- spec/app/editor-spec.coffee | 14 ++++++++++++++ src/app/editor.coffee | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 885981485..915a4e872 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -572,6 +572,20 @@ describe "Editor", -> expect(range.start).toEqual({row: 4, column: 10}) expect(range.end).toEqual({row: 4, column: 10}) + it "ignores ctrl-click and drags", -> + editor.attachToDom() + editor.css(position: 'absolute', top: 10, left: 10) + + event = mousedownEvent(editor: editor, point: [4, 10]) + event.ctrlKey = true + editor.renderedLines.trigger(event) + $(document).trigger mousemoveEvent(editor: editor, point: [5, 27]) + $(document).trigger 'mouseup' + + range = editor.getSelection().getScreenRange() + expect(range.start).toEqual({row: 4, column: 10}) + expect(range.end).toEqual({row: 4, column: 10}) + describe "double-click and drag", -> it "selects the word under the cursor, then continues to select by word in either direction as the mouse is dragged", -> expect(editor.getCursorScreenPosition()).toEqual(row: 0, column: 0) diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 9377de760..2f383f87d 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -373,7 +373,7 @@ class Editor extends View else if clickCount == 3 @activeEditSession.selectLine() unless e.shiftKey - @selectOnMousemoveUntilMouseup() unless e.originalEvent.which > 1 + @selectOnMousemoveUntilMouseup() unless e.ctrlKey or e.originalEvent.which > 1 @renderedLines.on 'mousedown', onMouseDown From ff471ebf5b5e683ea7fdc9699eae22bf6f7b17a8 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 28 Mar 2013 22:08:53 -0400 Subject: [PATCH 05/24] :lipstick: --- spec/app/text-mate-grammar-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/app/text-mate-grammar-spec.coffee b/spec/app/text-mate-grammar-spec.coffee index 526717617..86aa17e9c 100644 --- a/spec/app/text-mate-grammar-spec.coffee +++ b/spec/app/text-mate-grammar-spec.coffee @@ -307,4 +307,4 @@ describe "TextMateGrammar", -> {tokens, ruleStack} = grammar.tokenizeLine("one(two(three(four(five(_param_)))))", originalRuleStack) expect(tokens.length).toBe 5 expect(tokens[4].value).toBe "three(four(five(_param_)))))" - expect(ruleStack).toEqual originalRuleStack \ No newline at end of file + expect(ruleStack).toEqual originalRuleStack From 0a6963a9654b5a14990eefeaacf683580ecf27d7 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Fri, 29 Mar 2013 09:36:51 -0700 Subject: [PATCH 06/24] Bump node-git to 0.11.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d0dfb7ff..8141637a0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "ctags": "0.3.0", "oniguruma": "0.8.0", "mkdirp": "0.3.5", - "git-utils": "0.8.0", + "git-utils": "0.11.0", "underscore": "1.4.4", "d3": "3.0.8", "coffee-cache": "0.1.0", From 8e9a7355bcdfda02867da12d7ee79ea59291c64c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 29 Mar 2013 13:36:17 -0400 Subject: [PATCH 07/24] Return an empty array when the fs-utils.list() path isn't a directory This makes the common case of iterating over an array of paths and listing them cleaner since the return value doesn't need to be checked before it is iterated over. --- spec/stdlib/fs-utils-spec.coffee | 6 +++--- src/stdlib/fs-utils.coffee | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/stdlib/fs-utils-spec.coffee b/spec/stdlib/fs-utils-spec.coffee index 1e214e1dc..5317be474 100644 --- a/spec/stdlib/fs-utils-spec.coffee +++ b/spec/stdlib/fs-utils-spec.coffee @@ -130,9 +130,9 @@ describe "fs", -> expect(paths).toContain project.resolve('coffee.coffee') expect(paths).toContain project.resolve('two-hundred.txt') - it "returns undefined for paths that aren't directories or don't exist", -> - expect(fs.list(project.resolve('sample.js'))).toBeUndefined() - expect(fs.list('/non/existent/directory')).toBeUndefined() + it "returns an empty array for paths that aren't directories or don't exist", -> + expect(fs.list(project.resolve('sample.js'))).toEqual [] + expect(fs.list('/non/existent/directory')).toEqual [] it "can filter the paths by an optional array of file extensions", -> paths = fs.list(project.getPath(), ['.css', 'coffee']) diff --git a/src/stdlib/fs-utils.coffee b/src/stdlib/fs-utils.coffee index 1acf41169..a422f1e10 100644 --- a/src/stdlib/fs-utils.coffee +++ b/src/stdlib/fs-utils.coffee @@ -90,7 +90,7 @@ module.exports = # Returns an array with all the names of files contained # in the directory path. list: (rootPath, extensions) -> - return unless @isDirectory(rootPath) + return [] unless @isDirectory(rootPath) paths = fs.readdirSync(rootPath) paths = @filterExtensions(paths, extensions) if extensions paths = paths.map (path) => @join(rootPath, path) From 3773061cb5445c3d54ca11265c37b2276c6adead Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 29 Mar 2013 14:15:20 -0400 Subject: [PATCH 08/24] Remove unneeded empty array fallback --- src/app/keymap.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/keymap.coffee b/src/app/keymap.coffee index 71be30cec..23e585ee7 100644 --- a/src/app/keymap.coffee +++ b/src/app/keymap.coffee @@ -38,7 +38,7 @@ class Keymap @loadDirectory(fs.join(config.configDirPath, 'keymaps')) loadDirectory: (directoryPath) -> - @load(filePath) for filePath in fs.list(directoryPath, ['.cson', '.json']) ? [] + @load(filePath) for filePath in fs.list(directoryPath, ['.cson', '.json']) load: (path) -> @add(path, CSON.readObject(path)) From a9175665fa0a62a203fef3ee9b5f35805fa2293c Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Fri, 29 Mar 2013 09:54:16 -0700 Subject: [PATCH 09/24] :lipstick: --- src/app/window.coffee | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/app/window.coffee b/src/app/window.coffee index f6c513c2d..84a6764d9 100644 --- a/src/app/window.coffee +++ b/src/app/window.coffee @@ -1,5 +1,6 @@ fs = require 'fs-utils' $ = require 'jquery' +_ = require 'underscore' {less} = require 'less' {spawn} = require 'child_process' require 'jquery-extensions' @@ -36,12 +37,9 @@ window.setUpEnvironment = -> # This method is only called when opening a real application window window.startup = -> - if fs.isDirectory('/opt/boxen') - installAtomCommand('/opt/boxen/bin/atom') - else if fs.isDirectory('/opt/github') - installAtomCommand('/opt/github/bin/atom') - else if fs.isDirectory('/usr/local') - installAtomCommand('/usr/local/bin/atom') + directory = _.find ['/opt/boxen', '/opt/github', '/usr/local'], (dir) -> fs.isDirectory(dir) + if directory + installAtomCommand(fs.join(directory, 'bin/atom')) else console.warn "Failed to install `atom` binary" From 7d9e64a52dc2c9b25c2c8405e3451cc411f48ed3 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Fri, 29 Mar 2013 11:21:40 -0700 Subject: [PATCH 10/24] Mock getMaxTokensPerLine instead of overwriting member var --- spec/app/text-mate-grammar-spec.coffee | 2 +- src/app/text-mate-grammar.coffee | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/app/text-mate-grammar-spec.coffee b/spec/app/text-mate-grammar-spec.coffee index 86aa17e9c..c23bfd6b8 100644 --- a/spec/app/text-mate-grammar-spec.coffee +++ b/spec/app/text-mate-grammar-spec.coffee @@ -302,7 +302,7 @@ describe "TextMateGrammar", -> describe "when a line has more tokens than `maxTokensPerLine`", -> it "creates a final token with the remaining text and resets the ruleStack to match the begining of the line", -> grammar = syntax.selectGrammar("hello.js") - grammar.maxTokensPerLine = 5 + spyOn(grammar, 'getMaxTokensPerLine').andCallFake -> 5 originalRuleStack = [grammar.initialRule, grammar.initialRule, grammar.initialRule] {tokens, ruleStack} = grammar.tokenizeLine("one(two(three(four(five(_param_)))))", originalRuleStack) expect(tokens.length).toBe 5 diff --git a/src/app/text-mate-grammar.coffee b/src/app/text-mate-grammar.coffee index 485fd668e..03b35b6ca 100644 --- a/src/app/text-mate-grammar.coffee +++ b/src/app/text-mate-grammar.coffee @@ -48,7 +48,7 @@ class TextMateGrammar previousRuleStackLength = ruleStack.length previousPosition = position - if tokens.length >= (@maxTokensPerLine - 1) + if tokens.length >= (@getMaxTokensPerLine() - 1) token = new Token(value: line[position..], scopes: scopes) tokens.push token ruleStack = originalRuleStack @@ -87,6 +87,9 @@ class TextMateGrammar ruleStack.forEach (rule) -> rule.clearAnchorPosition() { tokens, ruleStack } + getMaxTokensPerLine: -> + @maxTokensPerLine + class Rule grammar: null scopeName: null From 1c5b72e04db555b9fc262d1493fac5f46f0900d8 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 29 Mar 2013 14:07:09 -0700 Subject: [PATCH 11/24] Add version to the Atom Helper plist Closes #368 --- atom.gyp | 2 ++ native/mac/Atom-Info.plist | 4 ++-- native/mac/helper-info.plist | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/atom.gyp b/atom.gyp index 12e5a54f3..f2068432c 100644 --- a/atom.gyp +++ b/atom.gyp @@ -1,5 +1,6 @@ { 'variables': { + 'version': '2.0', 'pkg-config': 'pkg-config', 'chromium_code': 1, 'use_aura%': 0, @@ -42,6 +43,7 @@ }, }, 'xcode_settings': { + 'VERSION': "<(version)", 'CLANG_CXX_LANGUAGE_STANDARD' : 'c++0x', 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', 'COMBINE_HIDPI_IMAGES': 'YES', # Removes 'Validate Project Settings' warning diff --git a/native/mac/Atom-Info.plist b/native/mac/Atom-Info.plist index 86a352764..85825a5c5 100644 --- a/native/mac/Atom-Info.plist +++ b/native/mac/Atom-Info.plist @@ -31,11 +31,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.0 + $VERSION CFBundleSignature ???? CFBundleVersion - 2.0 + $VERSION LSApplicationCategoryType public.app-category.developer-tools NSMainNibFile diff --git a/native/mac/helper-info.plist b/native/mac/helper-info.plist index a90b9f27c..f61887e28 100644 --- a/native/mac/helper-info.plist +++ b/native/mac/helper-info.plist @@ -4,6 +4,10 @@ CFBundleDevelopmentRegion en + CFBundleShortVersionString + $VERSION + CFBundleVersion + $VERSION CFBundleDisplayName ${EXECUTABLE_NAME} CFBundleExecutable From 142d18bb7c0f59fc47dcc452736d21b14177e48c Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 29 Mar 2013 14:07:30 -0700 Subject: [PATCH 12/24] Add current commit sha to the version --- atom.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom.gyp b/atom.gyp index f2068432c..e3ceb2326 100644 --- a/atom.gyp +++ b/atom.gyp @@ -1,6 +1,6 @@ { 'variables': { - 'version': '2.0', + 'version': '2.0. Date: Fri, 29 Mar 2013 15:00:24 -0700 Subject: [PATCH 13/24] Allow theme's package.cson to leave off stylesheet extension --- src/app/atom-theme.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/atom-theme.coffee b/src/app/atom-theme.coffee index 06f765118..3fab3f9e7 100644 --- a/src/app/atom-theme.coffee +++ b/src/app/atom-theme.coffee @@ -16,7 +16,9 @@ class AtomTheme extends Theme if fs.isFile(metadataPath) stylesheetNames = CSON.readObject(metadataPath)?.stylesheets if stylesheetNames - @loadStylesheet(fs.join(@path, name)) for name in stylesheetNames + for name in stylesheetNames + filename = fs.resolveExtension(fs.join(@path, name), ['.css', '.less', '']) + @loadStylesheet(filename) else @loadStylesheet(stylesheetPath) for stylesheetPath in fs.list(@path, ['.css', '.less']) From 4b146f3459d8a68ac9a8ac9624ecb36596fe2362 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 29 Mar 2013 14:26:07 -0700 Subject: [PATCH 14/24] Remove css extensions from themes package.cson stylesheet list --- themes/atom-dark-ui/package.cson | 18 +++++++++--------- themes/atom-light-ui/package.cson | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/themes/atom-dark-ui/package.cson b/themes/atom-dark-ui/package.cson index 53831688d..7aa632dc4 100644 --- a/themes/atom-dark-ui/package.cson +++ b/themes/atom-dark-ui/package.cson @@ -1,11 +1,11 @@ 'stylesheets': [ - 'atom.css' - 'editor.css' - 'select-list.css' - 'tree-view.css' - 'tabs.css' - 'status-bar.css' - 'command-panel.css' - 'command-logger.css' - 'blurred.css' + 'atom' + 'editor' + 'select-list' + 'tree-view' + 'tabs' + 'status-bar' + 'command-panel' + 'command-logger' + 'blurred' ] diff --git a/themes/atom-light-ui/package.cson b/themes/atom-light-ui/package.cson index 18cff697d..7f3d899c5 100644 --- a/themes/atom-light-ui/package.cson +++ b/themes/atom-light-ui/package.cson @@ -1,12 +1,12 @@ 'stylesheets': [ - 'atom.css' - 'editor.css' - 'overlay.css' - 'select-list.css' - 'tree-view.css' - 'tabs.css' - 'status-bar.css' - 'command-panel.css' - 'command-logger.css' - 'blurred.css' + 'atom' + 'editor' + 'overlay' + 'select-list' + 'tree-view' + 'tabs' + 'status-bar' + 'command-panel' + 'command-logger' + 'blurred' ] From 00c1fdce386d4ab5cd7c813ab5448512a8eaec5c Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 29 Mar 2013 14:28:12 -0700 Subject: [PATCH 15/24] Change theme extension to .less --- themes/atom-dark-ui/{atom.css => atom.less} | 0 themes/atom-dark-ui/{blurred.css => blurred.less} | 0 themes/atom-dark-ui/{command-logger.css => command-logger.less} | 0 themes/atom-dark-ui/{command-panel.css => command-panel.less} | 0 themes/atom-dark-ui/{editor.css => editor.less} | 0 themes/atom-dark-ui/{select-list.css => select-list.less} | 0 themes/atom-dark-ui/{status-bar.css => status-bar.less} | 0 themes/atom-dark-ui/{tabs.css => tabs.less} | 0 themes/atom-dark-ui/{tree-view.css => tree-view.less} | 0 themes/atom-light-ui/{atom.css => atom.less} | 0 themes/atom-light-ui/{blurred.css => blurred.less} | 0 themes/atom-light-ui/{command-logger.css => command-logger.less} | 0 themes/atom-light-ui/{command-panel.css => command-panel.less} | 0 themes/atom-light-ui/{editor.css => editor.less} | 0 themes/atom-light-ui/{overlay.css => overlay.less} | 0 themes/atom-light-ui/{select-list.css => select-list.less} | 0 themes/atom-light-ui/{status-bar.css => status-bar.less} | 0 themes/atom-light-ui/{tabs.css => tabs.less} | 0 themes/atom-light-ui/{tree-view.css => tree-view.less} | 0 19 files changed, 0 insertions(+), 0 deletions(-) rename themes/atom-dark-ui/{atom.css => atom.less} (100%) rename themes/atom-dark-ui/{blurred.css => blurred.less} (100%) rename themes/atom-dark-ui/{command-logger.css => command-logger.less} (100%) rename themes/atom-dark-ui/{command-panel.css => command-panel.less} (100%) rename themes/atom-dark-ui/{editor.css => editor.less} (100%) rename themes/atom-dark-ui/{select-list.css => select-list.less} (100%) rename themes/atom-dark-ui/{status-bar.css => status-bar.less} (100%) rename themes/atom-dark-ui/{tabs.css => tabs.less} (100%) rename themes/atom-dark-ui/{tree-view.css => tree-view.less} (100%) rename themes/atom-light-ui/{atom.css => atom.less} (100%) rename themes/atom-light-ui/{blurred.css => blurred.less} (100%) rename themes/atom-light-ui/{command-logger.css => command-logger.less} (100%) rename themes/atom-light-ui/{command-panel.css => command-panel.less} (100%) rename themes/atom-light-ui/{editor.css => editor.less} (100%) rename themes/atom-light-ui/{overlay.css => overlay.less} (100%) rename themes/atom-light-ui/{select-list.css => select-list.less} (100%) rename themes/atom-light-ui/{status-bar.css => status-bar.less} (100%) rename themes/atom-light-ui/{tabs.css => tabs.less} (100%) rename themes/atom-light-ui/{tree-view.css => tree-view.less} (100%) diff --git a/themes/atom-dark-ui/atom.css b/themes/atom-dark-ui/atom.less similarity index 100% rename from themes/atom-dark-ui/atom.css rename to themes/atom-dark-ui/atom.less diff --git a/themes/atom-dark-ui/blurred.css b/themes/atom-dark-ui/blurred.less similarity index 100% rename from themes/atom-dark-ui/blurred.css rename to themes/atom-dark-ui/blurred.less diff --git a/themes/atom-dark-ui/command-logger.css b/themes/atom-dark-ui/command-logger.less similarity index 100% rename from themes/atom-dark-ui/command-logger.css rename to themes/atom-dark-ui/command-logger.less diff --git a/themes/atom-dark-ui/command-panel.css b/themes/atom-dark-ui/command-panel.less similarity index 100% rename from themes/atom-dark-ui/command-panel.css rename to themes/atom-dark-ui/command-panel.less diff --git a/themes/atom-dark-ui/editor.css b/themes/atom-dark-ui/editor.less similarity index 100% rename from themes/atom-dark-ui/editor.css rename to themes/atom-dark-ui/editor.less diff --git a/themes/atom-dark-ui/select-list.css b/themes/atom-dark-ui/select-list.less similarity index 100% rename from themes/atom-dark-ui/select-list.css rename to themes/atom-dark-ui/select-list.less diff --git a/themes/atom-dark-ui/status-bar.css b/themes/atom-dark-ui/status-bar.less similarity index 100% rename from themes/atom-dark-ui/status-bar.css rename to themes/atom-dark-ui/status-bar.less diff --git a/themes/atom-dark-ui/tabs.css b/themes/atom-dark-ui/tabs.less similarity index 100% rename from themes/atom-dark-ui/tabs.css rename to themes/atom-dark-ui/tabs.less diff --git a/themes/atom-dark-ui/tree-view.css b/themes/atom-dark-ui/tree-view.less similarity index 100% rename from themes/atom-dark-ui/tree-view.css rename to themes/atom-dark-ui/tree-view.less diff --git a/themes/atom-light-ui/atom.css b/themes/atom-light-ui/atom.less similarity index 100% rename from themes/atom-light-ui/atom.css rename to themes/atom-light-ui/atom.less diff --git a/themes/atom-light-ui/blurred.css b/themes/atom-light-ui/blurred.less similarity index 100% rename from themes/atom-light-ui/blurred.css rename to themes/atom-light-ui/blurred.less diff --git a/themes/atom-light-ui/command-logger.css b/themes/atom-light-ui/command-logger.less similarity index 100% rename from themes/atom-light-ui/command-logger.css rename to themes/atom-light-ui/command-logger.less diff --git a/themes/atom-light-ui/command-panel.css b/themes/atom-light-ui/command-panel.less similarity index 100% rename from themes/atom-light-ui/command-panel.css rename to themes/atom-light-ui/command-panel.less diff --git a/themes/atom-light-ui/editor.css b/themes/atom-light-ui/editor.less similarity index 100% rename from themes/atom-light-ui/editor.css rename to themes/atom-light-ui/editor.less diff --git a/themes/atom-light-ui/overlay.css b/themes/atom-light-ui/overlay.less similarity index 100% rename from themes/atom-light-ui/overlay.css rename to themes/atom-light-ui/overlay.less diff --git a/themes/atom-light-ui/select-list.css b/themes/atom-light-ui/select-list.less similarity index 100% rename from themes/atom-light-ui/select-list.css rename to themes/atom-light-ui/select-list.less diff --git a/themes/atom-light-ui/status-bar.css b/themes/atom-light-ui/status-bar.less similarity index 100% rename from themes/atom-light-ui/status-bar.css rename to themes/atom-light-ui/status-bar.less diff --git a/themes/atom-light-ui/tabs.css b/themes/atom-light-ui/tabs.less similarity index 100% rename from themes/atom-light-ui/tabs.css rename to themes/atom-light-ui/tabs.less diff --git a/themes/atom-light-ui/tree-view.css b/themes/atom-light-ui/tree-view.less similarity index 100% rename from themes/atom-light-ui/tree-view.css rename to themes/atom-light-ui/tree-view.less From cf07eef3aef3bb964e001219532bec392b94d822 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 29 Mar 2013 15:09:53 -0700 Subject: [PATCH 16/24] Only change text color when select list item matches `:hover` Closes #303 --- themes/atom-dark-ui/select-list.less | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/atom-dark-ui/select-list.less b/themes/atom-dark-ui/select-list.less index 41740ab83..bbe192765 100644 --- a/themes/atom-dark-ui/select-list.less +++ b/themes/atom-dark-ui/select-list.less @@ -4,7 +4,7 @@ } .select-list li .label { - color: #ddd; + color: #bbb; } .select-list .key-binding { @@ -17,8 +17,8 @@ line-height: 100%; } -.select-list li:hover { - background-color: #2c2c2c; +.select-list li:hover .label { + color: #fff; } .select-list ol .selected { From 05336dc38c4ff41845a97829501ec8b756ccb1b9 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 29 Mar 2013 15:24:27 -0700 Subject: [PATCH 17/24] Fix atom.version spec --- spec/app/atom-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/app/atom-spec.coffee b/spec/app/atom-spec.coffee index 8b32d3d79..df2ff94d0 100644 --- a/spec/app/atom-spec.coffee +++ b/spec/app/atom-spec.coffee @@ -249,7 +249,7 @@ describe "the `atom` global", -> versionHandler.callCount > 0 runs -> - expect(versionHandler.argsForCall[0][0]).toMatch /^\d+\.\d+(\.\d+)?$/ + expect(versionHandler.argsForCall[0][0]).toMatch /^\d+\.\d+\.\w+$/ describe "modal native dialogs", -> beforeEach -> From d3920cdc05bf8a141e9511a9ac8267f19453b204 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Fri, 29 Mar 2013 17:54:03 -0700 Subject: [PATCH 18/24] Click and drag on the gutter selects lines correctly Closes #352 --- spec/app/editor-spec.coffee | 41 ++++++++++++++++++++++++++----------- src/app/editor.coffee | 4 ---- src/app/gutter.coffee | 40 ++++++++++++++++++++++++++++-------- 3 files changed, 60 insertions(+), 25 deletions(-) diff --git a/spec/app/editor-spec.coffee b/spec/app/editor-spec.coffee index 915a4e872..bbfa1ba99 100644 --- a/spec/app/editor-spec.coffee +++ b/spec/app/editor-spec.coffee @@ -2045,23 +2045,40 @@ describe "Editor", -> event.originalEvent = {detail: 1} event.shiftKey = true editor.gutter.find(".line-number:eq(1)").trigger event - expect(editor.getSelection().getScreenRange()).toEqual [[0,0], [1,0]] + expect(editor.getSelection().getScreenRange()).toEqual [[0,0], [2,0]] describe "when mousing down and then moving across multiple lines before mousing up", -> - it "selects the lines", -> - mousedownEvent = $.Event("mousedown") - mousedownEvent.pageY = editor.gutter.find(".line-number:eq(1)").offset().top - mousedownEvent.originalEvent = {detail: 1} - editor.gutter.find(".line-number:eq(1)").trigger mousedownEvent + describe "when selecting from top to bottom", -> + it "selects the lines", -> + mousedownEvent = $.Event("mousedown") + mousedownEvent.pageY = editor.gutter.find(".line-number:eq(1)").offset().top + mousedownEvent.originalEvent = {detail: 1} + editor.gutter.find(".line-number:eq(1)").trigger mousedownEvent - mousemoveEvent = $.Event("mousemove") - mousemoveEvent.pageY = editor.gutter.find(".line-number:eq(5)").offset().top - mousemoveEvent.originalEvent = {detail: 1} - editor.gutter.find(".line-number:eq(5)").trigger mousemoveEvent + mousemoveEvent = $.Event("mousemove") + mousemoveEvent.pageY = editor.gutter.find(".line-number:eq(5)").offset().top + mousemoveEvent.originalEvent = {detail: 1} + editor.gutter.find(".line-number:eq(5)").trigger mousemoveEvent - $(document).trigger 'mouseup' + $(document).trigger 'mouseup' - expect(editor.getSelection().getScreenRange()).toEqual [[1,0], [5,30]] + expect(editor.getSelection().getScreenRange()).toEqual [[1,0], [6,0]] + + describe "when selecting from bottom to top", -> + it "selects the lines", -> + mousedownEvent = $.Event("mousedown") + mousedownEvent.pageY = editor.gutter.find(".line-number:eq(5)").offset().top + mousedownEvent.originalEvent = {detail: 1} + editor.gutter.find(".line-number:eq(5)").trigger mousedownEvent + + mousemoveEvent = $.Event("mousemove") + mousemoveEvent.pageY = editor.gutter.find(".line-number:eq(1)").offset().top + mousemoveEvent.originalEvent = {detail: 1} + editor.gutter.find(".line-number:eq(1)").trigger mousemoveEvent + + $(document).trigger 'mouseup' + + expect(editor.getSelection().getScreenRange()).toEqual [[1,0], [6,0]] describe "when clicking below the last line", -> beforeEach -> diff --git a/src/app/editor.coffee b/src/app/editor.coffee index 2f383f87d..42effb3a7 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -393,10 +393,6 @@ class Editor extends View @gutter.widthChanged = (newWidth) => @scrollView.css('left', newWidth + 'px') - @gutter.on 'mousedown', (e) => - e.pageX = @renderedLines.offset().left - onMouseDown(e) - @scrollView.on 'scroll', => if @scrollView.scrollLeft() == 0 @gutter.removeClass('drop-shadow') diff --git a/src/app/gutter.coffee b/src/app/gutter.coffee index 2e19e09c6..da97e6e89 100644 --- a/src/app/gutter.coffee +++ b/src/app/gutter.coffee @@ -1,5 +1,6 @@ {View, $$, $$$} = require 'space-pen' Range = require 'range' +$ = require 'jquery' _ = require 'underscore' module.exports = @@ -16,21 +17,42 @@ class Gutter extends View return if @attached or not onDom @attached = true - editor = @editor() highlightLines = => @highlightLines() - editor.on 'cursor:moved', highlightLines - editor.on 'selection:changed', highlightLines + @getEditor().on 'cursor:moved', highlightLines + @getEditor().on 'selection:changed', highlightLines + @on 'mousedown', (e) => @handleMouseEvents(e) - editor: -> + getEditor: -> @parentView + beforeRemove: -> + $(document).off(".gutter-#{@getEditor().id}") + + handleMouseEvents: (e) -> + editor = @getEditor() + startRow = editor.screenPositionFromMouseEvent(e).row + if e.shiftKey + editor.selectToScreenPosition([startRow + 1, 0]) + return + else + editor.getSelection().setScreenRange([[startRow, 0], [startRow, 0]]) + + moveHandler = (e) => + start = startRow + end = editor.screenPositionFromMouseEvent(e).row + if end > start then end++ else start++ + editor.getSelection().setScreenRange([[start, 0], [end, 0]]) + + $(document).on "mousemove.gutter-#{@getEditor().id}", moveHandler + $(document).one "mouseup.gutter-#{@getEditor().id}", => $(document).off 'mousemove', moveHandler + setShowLineNumbers: (showLineNumbers) -> if showLineNumbers then @lineNumbers.show() else @lineNumbers.hide() updateLineNumbers: (changes, renderFrom, renderTo) -> if renderFrom < @firstScreenRow or renderTo > @lastScreenRow performUpdate = true - else if @editor().getLastScreenRow() < @lastScreenRow + else if @getEditor().getLastScreenRow() < @lastScreenRow performUpdate = true else for change in changes @@ -41,7 +63,7 @@ class Gutter extends View @renderLineNumbers(renderFrom, renderTo) if performUpdate renderLineNumbers: (startScreenRow, endScreenRow) -> - editor = @editor() + editor = @getEditor() maxDigits = editor.getLineCount().toString().length rows = editor.bufferRowsForScreenRows(startScreenRow, endScreenRow) @@ -81,8 +103,8 @@ class Gutter extends View @highlightedLineNumbers.push(highlightedLineNumber) highlightLines: -> - if @editor().getSelection().isEmpty() - row = @editor().getCursorScreenPosition().row + if @getEditor().getSelection().isEmpty() + row = @getEditor().getCursorScreenPosition().row rowRange = new Range([row, 0], [row, 0]) return if @selectionEmpty and @highlightedRows?.isEqual(rowRange) @@ -91,7 +113,7 @@ class Gutter extends View @highlightedRows = rowRange @selectionEmpty = true else - selectedRows = @editor().getSelection().getScreenRange() + selectedRows = @getEditor().getSelection().getScreenRange() endRow = selectedRows.end.row endRow-- if selectedRows.end.column is 0 selectedRows = new Range([selectedRows.start.row, 0], [endRow, 0]) From 2a2a391d139e75dd867cf411536eace9640a7d96 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 29 Mar 2013 22:20:26 -0400 Subject: [PATCH 19/24] Extend highlight span to be entire width of tree Closes #219 --- src/packages/tree-view/lib/tree-view.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/packages/tree-view/lib/tree-view.coffee b/src/packages/tree-view/lib/tree-view.coffee index 18475fa06..c7e72221e 100644 --- a/src/packages/tree-view/lib/tree-view.coffee +++ b/src/packages/tree-view/lib/tree-view.coffee @@ -56,6 +56,7 @@ class TreeView extends ScrollView afterAttach: (onDom) -> @focus() if @focusAfterAttach @scrollTop(@scrollTopAfterAttach) if @scrollTopAfterAttach > 0 + @find('.selected > .highlight').width(@treeViewList[0].scrollWidth) serialize: -> directoryExpansionStates: @root?.serializeEntryExpansionStates() @@ -304,10 +305,11 @@ class TreeView extends ScrollView entry = entry.view() unless entry instanceof View @selectedPath = entry.getPath() @deselect() + entry.children('.highlight').width(@treeViewList[0].scrollWidth) entry.addClass('selected') deselect: -> - @treeViewList.find('.selected').removeClass('selected') + @treeViewList.find('.selected').removeClass('selected').children('.highlight').width('') scrollTop: (top) -> if top From 9708f436c55c3c12618e257a40c8a0b890d3c9be Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 29 Mar 2013 22:21:50 -0400 Subject: [PATCH 20/24] Remove unneeded empty string span values --- src/packages/tree-view/lib/directory-view.coffee | 2 +- src/packages/tree-view/lib/file-view.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/packages/tree-view/lib/directory-view.coffee b/src/packages/tree-view/lib/directory-view.coffee index c6f561c1d..6120d9c8e 100644 --- a/src/packages/tree-view/lib/directory-view.coffee +++ b/src/packages/tree-view/lib/directory-view.coffee @@ -11,7 +11,7 @@ class DirectoryView extends View @div outlet: 'header', class: 'header', => @span class: 'disclosure-arrow', outlet: 'disclosureArrow' @span directory.getBaseName(), class: 'name', outlet: 'directoryName' - @span "", class: 'highlight' + @span class: 'highlight' directory: null entries: null diff --git a/src/packages/tree-view/lib/file-view.coffee b/src/packages/tree-view/lib/file-view.coffee index 5f264a15f..1ff73c910 100644 --- a/src/packages/tree-view/lib/file-view.coffee +++ b/src/packages/tree-view/lib/file-view.coffee @@ -9,7 +9,7 @@ class FileView extends View @content: ({file} = {}) -> @li class: 'file entry', => @span file.getBaseName(), class: 'name', outlet: 'fileName' - @span '', class: 'highlight' + @span class: 'highlight' file: null From dc3b26c934826ea86f4940065b85eda3a597d37f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 29 Mar 2013 23:55:31 -0400 Subject: [PATCH 21/24] Add missing 't' in spec file name --- spec/app/{tex-buffer-spec.coffee => text-buffer-spec.coffee} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spec/app/{tex-buffer-spec.coffee => text-buffer-spec.coffee} (100%) diff --git a/spec/app/tex-buffer-spec.coffee b/spec/app/text-buffer-spec.coffee similarity index 100% rename from spec/app/tex-buffer-spec.coffee rename to spec/app/text-buffer-spec.coffee From da090b57d492e26117d781067076fa20452c5beb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Sat, 30 Mar 2013 00:25:57 -0400 Subject: [PATCH 22/24] Use line ending length for mapping positions/characters Previously the line ending length was hard-coded to one which would cause TextBuffer.scanInRange() to return incorrect results since one character per line wasn't being accounted for. Closes #428 --- spec/app/text-buffer-spec.coffee | 14 ++++++++++++++ src/app/text-buffer.coffee | 10 +++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/spec/app/text-buffer-spec.coffee b/spec/app/text-buffer-spec.coffee index 63d50b797..3504876c0 100644 --- a/spec/app/text-buffer-spec.coffee +++ b/spec/app/text-buffer-spec.coffee @@ -725,6 +725,13 @@ describe 'Buffer', -> expect(buffer.characterIndexForPosition([2, 0])).toBe 61 expect(buffer.characterIndexForPosition([12, 2])).toBe 408 + describe "when the buffer contains crlf line endings", -> + it "returns the total number of characters that precede the given position", -> + buffer.setText("line1\r\nline2\nline3\r\nline4") + expect(buffer.characterIndexForPosition([1])).toBe 7 + expect(buffer.characterIndexForPosition([2])).toBe 13 + expect(buffer.characterIndexForPosition([3])).toBe 20 + describe ".positionForCharacterIndex(position)", -> it "returns the position based on character index", -> expect(buffer.positionForCharacterIndex(0)).toEqual [0, 0] @@ -734,6 +741,13 @@ describe 'Buffer', -> expect(buffer.positionForCharacterIndex(61)).toEqual [2, 0] expect(buffer.positionForCharacterIndex(408)).toEqual [12, 2] + describe "when the buffer contains crlf line endings", -> + it "returns the position based on character index", -> + buffer.setText("line1\r\nline2\nline3\r\nline4") + expect(buffer.positionForCharacterIndex(7)).toEqual [1, 0] + expect(buffer.positionForCharacterIndex(13)).toEqual [2, 0] + expect(buffer.positionForCharacterIndex(20)).toEqual [3, 0] + describe "markers", -> describe "marker creation", -> it "allows markers to be created with ranges and positions", -> diff --git a/src/app/text-buffer.coffee b/src/app/text-buffer.coffee index 2c5c623e3..d471cee26 100644 --- a/src/app/text-buffer.coffee +++ b/src/app/text-buffer.coffee @@ -145,6 +145,9 @@ class Buffer lineLengthForRow: (row) -> @lines[row].length + lineEndingLengthForRow: (row) -> + (@lineEndingForRow(row) ? '').length + rangeForRow: (row, { includeNewline } = {}) -> if includeNewline and row < @getLastRow() new Range([row, 0], [row + 1, 0]) @@ -168,12 +171,13 @@ class Buffer position = Point.fromObject(position) index = 0 - index += @lineLengthForRow(row) + 1 for row in [0...position.row] + for row in [0...position.row] + index += @lineLengthForRow(row) + Math.max(@lineEndingLengthForRow(row), 1) index + position.column positionForCharacterIndex: (index) -> row = 0 - while index >= (lineLength = @lineLengthForRow(row) + 1) + while index >= (lineLength = @lineLengthForRow(row) + Math.max(@lineEndingLengthForRow(row), 1)) index -= lineLength row++ @@ -358,7 +362,7 @@ class Buffer @scanInRange(regex, @getRange(), iterator) scanInRange: (regex, range, iterator, reverse=false) -> - range = Range.fromObject(range) + range = @clipRange(range) global = regex.global flags = "gm" flags += "i" if regex.ignoreCase From 19162db3ce008f28b58da7b24e0a5cb054d99f3c Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Sat, 30 Mar 2013 00:46:57 -0400 Subject: [PATCH 23/24] Clip TextBuffer.characterIndexForPosition() position --- spec/app/text-buffer-spec.coffee | 1 + src/app/text-buffer.coffee | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/app/text-buffer-spec.coffee b/spec/app/text-buffer-spec.coffee index 3504876c0..0bf327d4c 100644 --- a/spec/app/text-buffer-spec.coffee +++ b/spec/app/text-buffer-spec.coffee @@ -724,6 +724,7 @@ describe 'Buffer', -> expect(buffer.characterIndexForPosition([1, 0])).toBe 30 expect(buffer.characterIndexForPosition([2, 0])).toBe 61 expect(buffer.characterIndexForPosition([12, 2])).toBe 408 + expect(buffer.characterIndexForPosition([Infinity])).toBe 408 describe "when the buffer contains crlf line endings", -> it "returns the total number of characters that precede the given position", -> diff --git a/src/app/text-buffer.coffee b/src/app/text-buffer.coffee index d471cee26..bd06299d2 100644 --- a/src/app/text-buffer.coffee +++ b/src/app/text-buffer.coffee @@ -168,7 +168,7 @@ class Buffer new Point(lastRow, @lineLengthForRow(lastRow)) characterIndexForPosition: (position) -> - position = Point.fromObject(position) + position = @clipPosition(position) index = 0 for row in [0...position.row] From 5e5437502f4f823aeebb980ab81ff6de39fc4a5e Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 31 Mar 2013 00:45:05 -0700 Subject: [PATCH 24/24] reset --- src/app/project.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/project.coffee b/src/app/project.coffee index d6651e727..bb0d30ecf 100644 --- a/src/app/project.coffee +++ b/src/app/project.coffee @@ -192,7 +192,7 @@ class Project readPath(line) if state is 'readingPath' readLine(line) if state is 'readingLines' - command = require.resolve('ag') + command = require.resolve('nak') args = ['--ackmate', regex.source, @getPath()] new BufferedProcess({command, args, stdout, exit}) deferred