Restore old UI

This commit is contained in:
Garen Torikian
2013-03-31 01:02:53 -07:00
parent f48355ce10
commit 4cd181022d
4 changed files with 14 additions and 16 deletions

View File

@@ -176,8 +176,7 @@ class Project
for [column, length] in matchPositions
range = new Range([row, column], [row, column + length])
match = lineText.substr(column , length)
iterator({path, range, match, lineText})
iterator({path, range, lineText})
deferred = $.Deferred()
exit = (code) ->

View File

@@ -12,8 +12,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: 'collapse', 'Collapse All'
@span outlet: 'previewCount', class: 'preview-count'
@@ -53,8 +53,7 @@ class CommandPanelView extends View
@previewList.hide()
@previewHeader.hide()
@errorMessages.hide()
@searchLoadingMessage.hide()
@expandCollapse.hide()
@loadingMessage.hide()
@prompt.iconSize(@miniEditor.getFontSize())
@history = state.history ? []
@@ -126,14 +125,13 @@ class CommandPanelView extends View
@miniEditor.getText()
execute: (command=@escapedCommand()) ->
@previewHeader.show()
@searchLoadingMessage.show()
@loadingMessage.show()
@previewList.hide()
@errorMessages.empty()
try
@commandInterpreter.eval(command, rootView.getActivePaneItem()).done ({operationsToPreview, errorMessages}) =>
@searchLoadingMessage.hide()
@expandCollapse.show()
@loadingMessage.hide()
@history.push(command)
@historyIndex = @history.length
@@ -143,13 +141,14 @@ 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
@detach()
catch error
@searchLoadingMessage.hide()
@loadingMessage.hide()
if error.name is "SyntaxError"
@flashError()
return

View File

@@ -13,13 +13,13 @@ class SelectAllMatchesInProject extends Command
compile: (project, buffer, range) ->
deferred = $.Deferred()
operations = []
promise = project.scan @regex, ({path, range, match, lineText}) ->
promise = project.scan @regex, ({path, range, lineText}) ->
operations.push(new Operation(
project: project
path: path
bufferRange: range
lineText: lineText
)
))
promise.done -> deferred.resolve(operations)
deferred.promise()
deferred.promise()

View File

@@ -24,9 +24,9 @@ class Operation
preview: ->
range = @bufferRange
prefix = @lineText[0...range.start.column]
match = @lineText[range.start.column...range.end.column]
suffix = @lineText[range.end.column..]
prefix = @lineText[0...range.start.column + 1]
match = @lineText[range.start.column + 1...range.end.column + 1]
suffix = @lineText[range.end.column + 1..]
{prefix, suffix, match, range}