From 6f982c7c4cc1d91a74d69d960fa10256995ae853 Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 31 Mar 2013 01:11:19 -0700 Subject: [PATCH] Fix spec --- spec/app/project-spec.coffee | 4 +++- src/app/project.coffee | 3 ++- .../lib/commands/select-all-matches-in-project.coffee | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/app/project-spec.coffee b/spec/app/project-spec.coffee index 53d17d5e0..cc3d3879e 100644 --- a/spec/app/project-spec.coffee +++ b/spec/app/project-spec.coffee @@ -188,7 +188,7 @@ describe "Project", -> runs -> expect(paths).not.toContain('ignored/ignored.txt') - describe ".scan(options, callback)", -> + fdescribe ".scan(options, callback)", -> describe "when called with a regex", -> it "calls the callback with all regex matches in all files in the project", -> matches = [] @@ -253,11 +253,13 @@ describe "Project", -> path: project.resolve('a') match: 'aa ' range: [[0, 0], [0, 3]] + lineText: 'aaa bbb' expect(iterator.argsForCall[1][0]).toEqual path: project.resolve('a') match: 'a ' range: [[1, 3], [1, 5]] + lineText: 'cc aa cc' describe "serialization", -> it "restores the project path", -> diff --git a/src/app/project.coffee b/src/app/project.coffee index fa8f0d864..3c10f744a 100644 --- a/src/app/project.coffee +++ b/src/app/project.coffee @@ -176,7 +176,8 @@ class Project for [column, length] in matchPositions range = new Range([row, column], [row, column + length]) - iterator({path, range, lineText}) + match = lineText.substr(column + 1, length) + iterator({path, range, match, lineText}) deferred = $.Deferred() exit = (code) -> diff --git a/src/packages/command-panel/lib/commands/select-all-matches-in-project.coffee b/src/packages/command-panel/lib/commands/select-all-matches-in-project.coffee index 35742ef46..20df613a3 100644 --- a/src/packages/command-panel/lib/commands/select-all-matches-in-project.coffee +++ b/src/packages/command-panel/lib/commands/select-all-matches-in-project.coffee @@ -13,7 +13,7 @@ class SelectAllMatchesInProject extends Command compile: (project, buffer, range) -> deferred = $.Deferred() operations = [] - promise = project.scan @regex, ({path, range, lineText}) -> + promise = project.scan @regex, ({path, range, match, lineText}) -> operations.push(new Operation( project: project path: path