From ea65421120bea48a55836ae85f8186c4910a3a2a Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Sun, 31 Mar 2013 00:30:39 -0700 Subject: [PATCH] Remove streaming changes --- .../lib/command-panel-view.coffee | 5 ++--- .../select-all-matches-in-project.coffee | 4 +--- .../command-panel/lib/preview-list.coffee | 22 +++++-------------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/packages/command-panel/lib/command-panel-view.coffee b/src/packages/command-panel/lib/command-panel-view.coffee index 7893f1145..b87aff9d2 100644 --- a/src/packages/command-panel/lib/command-panel-view.coffee +++ b/src/packages/command-panel/lib/command-panel-view.coffee @@ -129,7 +129,6 @@ class CommandPanelView extends View @previewHeader.show() @searchLoadingMessage.show() @errorMessages.empty() - project.previewList = @previewList try @commandInterpreter.eval(command, rootView.getActivePaneItem()).done ({operationsToPreview, errorMessages}) => @@ -144,9 +143,9 @@ class CommandPanelView extends View @errorMessages.append $$ -> @li errorMessage for errorMessage in errorMessages else if operationsToPreview?.length - @previewList.show() + @previewList.populate(operationsToPreview) @previewList.focus() - @previewCount.text("#{_.pluralize(operationsToPreview.length, 'match', 'matches')} in #{_.pluralize(@previewList.getPathCount(operationsToPreview), 'file')}").show() + @previewCount.text("#{_.pluralize(operationsToPreview.length, 'match', 'matches')} in #{_.pluralize(@previewList.getPathCount(), 'file')}").show() else @detach() catch error 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 65737f9cd..b0dd65e9e 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 @@ -14,14 +14,12 @@ class SelectAllMatchesInProject extends Command deferred = $.Deferred() operations = [] promise = project.scan @regex, ({path, range, match, lineText}) -> - op = new Operation( + operations.push(new Operation( project: project path: path bufferRange: range lineText: lineText ) - project.previewList.populateSingle(op) - operations.push(op) promise.done -> deferred.resolve(operations) deferred.promise() diff --git a/src/packages/command-panel/lib/preview-list.coffee b/src/packages/command-panel/lib/preview-list.coffee index 101eb99ae..49cb95835 100644 --- a/src/packages/command-panel/lib/preview-list.coffee +++ b/src/packages/command-panel/lib/preview-list.coffee @@ -19,7 +19,8 @@ class PreviewList extends ScrollView @on 'core:move-down', => @selectNextOperation(); false @on 'core:move-up', => @selectPreviousOperation(); false - + @on 'scroll', => + @renderOperations() if @scrollBottom() >= (@prop('scrollHeight')) @command 'command-panel:collapse-all', => @collapseAllPaths() @command 'command-panel:expand-all', => @expandAllPaths() @@ -27,6 +28,7 @@ class PreviewList extends ScrollView @children().each (index, element) -> $(element).view().expand() collapseAllPaths: -> + @renderOperations(renderAll: true) @children().each (index, element) -> $(element).view().collapse() destroy: -> @@ -46,14 +48,6 @@ class PreviewList extends ScrollView @find('.operation:first').addClass('selected') - populateSingle: (operation) -> - @viewsForPath ||= {} - - @lastRenderedOperationIndex ||= 0 - @renderOperation(operation) - - @find('.operation:first').addClass('selected') - renderOperations: ({renderAll}={}) -> renderAll ?= false startingScrollHeight = @prop('scrollHeight') @@ -62,12 +56,6 @@ class PreviewList extends ScrollView pathView.addOperation(operation) @lastRenderedOperationIndex++ break if not renderAll and @prop('scrollHeight') >= startingScrollHeight + @pixelOverdraw and @prop('scrollHeight') > @height() + @pixelOverdraw - - renderOperation: (operation) -> - startingScrollHeight = @prop('scrollHeight') - pathView = @pathViewForPath(operation.getPath()) - pathView.addOperation(operation) - @lastRenderedOperationIndex++ pathViewForPath: (path) -> pathView = @viewsForPath[path] @@ -106,8 +94,8 @@ class PreviewList extends ScrollView previousView.addClass('selected') previousView.scrollTo() - getPathCount: (operations=@operations)-> - _.keys(_.groupBy(operations, (operation) -> operation.getPath())).length + getPathCount: -> + _.keys(_.groupBy(@operations, (operation) -> operation.getPath())).length getOperations: -> new Array(@operations...)