Start figuring out where the pieces go

This commit is contained in:
Garen Torikian
2013-03-27 01:06:34 -07:00
parent 280e527f5a
commit 7233d9d64b
5 changed files with 17 additions and 11 deletions

View File

@@ -177,6 +177,7 @@ class Project
for [column, length] in matchPositions
range = new Range([row, column], [row, column + length])
match = lineText.substr(column, length)
console.log(path)
iterator({path, range, match})
deferred = $.Deferred()

View File

@@ -11,8 +11,8 @@ module.exports =
class CommandPanelView extends View
@content: ->
@div class: 'command-panel tool-panel', =>
@div class: 'loading is-loading', outlet: 'loadingMessage', 'Searching...'
@div class: 'header', outlet: 'previewHeader', =>
@span outlet: 'searchLoadingMessage', class: 'loading', 'Searching...'
@ul outlet: 'expandCollapse', class: 'expand-collapse', =>
@li class: 'expand', 'Expand All'
@li class: 'collapse', 'Collapse All'
@@ -53,7 +53,7 @@ class CommandPanelView extends View
@previewList.hide()
@previewHeader.hide()
@errorMessages.hide()
@loadingMessage.hide()
@searchLoadingMessage.hide()
@prompt.iconSize(@miniEditor.getFontSize())
@history = state.history ? []
@@ -116,12 +116,13 @@ class CommandPanelView extends View
@miniEditor.getText()
execute: (command=@escapedCommand()) ->
@loadingMessage.show()
@previewHeader.show()
@searchLoadingMessage.show()
@errorMessages.empty()
try
@commandInterpreter.eval(command, rootView.getActivePaneItem()).done ({operationsToPreview, errorMessages}) =>
@loadingMessage.hide()
@searchLoadingMessage.hide()
@history.push(command)
@historyIndex = @history.length
@@ -131,8 +132,6 @@ class CommandPanelView extends View
@errorMessages.append $$ ->
@li errorMessage for errorMessage in errorMessages
else if operationsToPreview?.length
@previewHeader.show()
@previewList.populate(operationsToPreview)
@previewList.focus()
@previewCount.text("#{_.pluralize(operationsToPreview.length, 'match', 'matches')} in #{_.pluralize(@previewList.getPathCount(), 'file')}").show()
else

View File

@@ -8,17 +8,21 @@ class SelectAllMatchesInProject extends Command
previewOperations: true
constructor: (pattern) ->
@regex = new RegExp(pattern, 'g')
debugger;
@regex = new RegExp(pattern)
compile: (project, buffer, range) ->
deferred = $.Deferred()
operations = []
promise = project.scan @regex, ({path, range}) ->
operations.push(new Operation(
debugger;
op = new Operation(
project: project
path: path
bufferRange: range
))
)
deferred.resolve([op])
operations.push(op)
promise.done -> deferred.resolve(operations)
promise.done# -> deferred.resolve(operations)
deferred.promise()

View File

@@ -39,7 +39,8 @@ class PreviewList extends ScrollView
hasOperations: -> @operations?
populate: (operations) ->
@destroyOperations() if @operations
debugger;
#@destroyOperations() if @operations
@operations = operations
@lastRenderedOperationIndex = 0
@empty()

View File

@@ -147,6 +147,7 @@ class FuzzyFinderView extends SelectList
path.indexOf(options.filter) >= 0
else
@projectPaths
console.log listedItems
@setArray(listedItems)
options.done(listedItems) if options.done?
else