diff --git a/spec/app/project-spec.coffee b/spec/app/project-spec.coffee index ab7e944de..5faf96952 100644 --- a/spec/app/project-spec.coffee +++ b/spec/app/project-spec.coffee @@ -253,13 +253,11 @@ describe "Project", -> path: project.resolve('a') match: 'aaa' range: [[0, 0], [0, 3]] - lineText: 'aaa bbb' expect(iterator.argsForCall[1][0]).toEqual path: project.resolve('a') match: 'aa' 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 6b29bab09..220c468a9 100644 --- a/src/app/project.coffee +++ b/src/app/project.coffee @@ -178,7 +178,7 @@ class Project for [column, length] in matchPositions range = new Range([row, column], [row, column + length]) match = lineText.substr(column, length) - iterator({path, range, match, lineText}) + iterator({path, range, match}) 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 6cf583596..c9255a4fc 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,12 +13,11 @@ class SelectAllMatchesInProject extends Command compile: (project, buffer, range) -> deferred = $.Deferred() operations = [] - promise = project.scan @regex, ({path, range, match, lineText}) -> + promise = project.scan @regex, ({path, range}) -> operations.push(new Operation( project: project path: path bufferRange: range - lineText: lineText )) promise.done -> deferred.resolve(operations) diff --git a/src/packages/command-panel/lib/operation.coffee b/src/packages/command-panel/lib/operation.coffee index 3dc17b29e..7f70b75e0 100644 --- a/src/packages/command-panel/lib/operation.coffee +++ b/src/packages/command-panel/lib/operation.coffee @@ -1,6 +1,6 @@ module.exports = class Operation - constructor: ({@project, @path, @buffer, @bufferRange, @lineText, @newText, @preserveSelection, @errorMessage}) -> + constructor: ({@project, @path, @buffer, @bufferRange, @newText, @preserveSelection, @errorMessage}) -> if @buffer? @buffer.retain() @getMarker() @@ -24,9 +24,10 @@ class Operation preview: -> range = @getBufferRange() - prefix = @lineText[0...range.start.column] - match = @lineText[range.start.column...range.end.column] - suffix = @lineText[range.end.column..] + line = @getBuffer().lineForRow(range.start.row) + prefix = line[0...range.start.column] + match = line[range.start.column...range.end.column] + suffix = line[range.end.column..] {prefix, suffix, match, range}