diff --git a/src/app/project.coffee b/src/app/project.coffee index 886e7a059..6c5ad78c6 100644 --- a/src/app/project.coffee +++ b/src/app/project.coffee @@ -177,7 +177,7 @@ class Project for [column, length] in matchPositions range = new Range([row, column], [row, column + length]) match = lineText.substr(column + 1, length) - iterator({path, range, match}) + 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 155d792cf..65737f9cd 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,11 +13,12 @@ class SelectAllMatchesInProject extends Command compile: (project, buffer, range) -> deferred = $.Deferred() operations = [] - promise = project.scan @regex, ({path, range}) -> + promise = project.scan @regex, ({path, range, match, lineText}) -> op = new Operation( project: project path: path bufferRange: range + lineText: lineText ) project.previewList.populateSingle(op) operations.push(op) diff --git a/src/packages/command-panel/lib/operation.coffee b/src/packages/command-panel/lib/operation.coffee index 9be9ad7f6..c0adac184 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, @newText, @preserveSelection, @errorMessage}) -> + constructor: ({@project, @path, @buffer, @bufferRange, @lineText, @newText, @preserveSelection, @errorMessage}) -> if @buffer? @buffer.retain() @getMarker() @@ -23,11 +23,10 @@ class Operation @getBufferRange() unless @preserveSelection preview: -> - range = @getBuffer().getMarkerRange(@getMarker()) - 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..] + range = @bufferRange + prefix = @lineText[0...range.start.column] + match = @lineText[range.start.column + 1...range.end.column] + suffix = @lineText[range.end.column..] {prefix, suffix, match, range} diff --git a/src/packages/command-panel/lib/preview-list.coffee b/src/packages/command-panel/lib/preview-list.coffee index 8569868fd..fe4c8a6b6 100644 --- a/src/packages/command-panel/lib/preview-list.coffee +++ b/src/packages/command-panel/lib/preview-list.coffee @@ -1,7 +1,6 @@ $ = require 'jquery' ScrollView = require 'scroll-view' _ = require 'underscore' -fs = require 'fs-utils' PathView = require './path-view' OperationView = require './operation-view' @@ -73,7 +72,6 @@ class PreviewList extends ScrollView pathView = @pathViewForPath(operation.getPath()) pathView.addOperation(operation) - pathViewForPath: (path) -> pathView = @viewsForPath[path] if not pathView