WIP: trying to make preview faster

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-07-19 11:28:41 -06:00
parent f0417e7287
commit 9e4f401485
3 changed files with 23 additions and 4 deletions

View File

@@ -140,7 +140,9 @@ class Project
regex = new RegExp(regex.source, 'g')
command = "#{require.resolve('ack')} --all --match \"#{regex.source}\" \"#{@getPath()}\""
bufferedData = ""
ChildProcess.exec command , bufferLines: true, stdout: (data) ->
console.log command
promise = ChildProcess.exec command , bufferLines: true, stdout: (data) ->
bufferedData += data
currentIndex = 0
while currentIndex < bufferedData.length
@@ -161,4 +163,7 @@ class Project
bufferedData = bufferedData.substring(currentIndex)
promise.done -> console.log "DONE"
_.extend Project.prototype, EventEmitter

View File

@@ -83,6 +83,12 @@ windowAdditions =
onerror: ->
$native.showDevTools()
measure: (description, fn) ->
start = new Date().getTime()
fn()
result = new Date().getTime() - start
console.log description, result
window[key] = value for key, value of windowAdditions
window.setUpKeymap()

View File

@@ -1,4 +1,4 @@
{View} = require 'space-pen'
{View, $$$} = require 'space-pen'
CommandInterpreter = require 'command-panel/command-interpreter'
RegexAddress = require 'command-panel/commands/regex-address'
CompositeCommand = require 'command-panel/commands/composite-command'
@@ -90,8 +90,16 @@ class CommandPanel extends View
populatePreviewList: (operations) ->
@previewedOperations = operations
@previewList.empty()
for operation in operations
@previewList.append(new PreviewItem(operation))
@previewList.html $$$ ->
for operation in operations
{prefix, suffix, match} = operation.preview()
@li =>
@span operation.getPath(), outlet: "path", class: "path"
@span outlet: "preview", class: "preview", =>
@span prefix
@span match, class: 'match'
@span suffix
@previewList.show()
navigateBackwardInHistory: ->