Stash filestream work

This commit is contained in:
Garen Torikian
2013-03-29 09:35:40 -07:00
parent 327b49797b
commit 082acf4386
4 changed files with 8 additions and 10 deletions

View File

@@ -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) ->

View File

@@ -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)

View File

@@ -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}

View File

@@ -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