diff --git a/src/app/project.coffee b/src/app/project.coffee index dea39f3c1..fa8f0d864 100644 --- a/src/app/project.coffee +++ b/src/app/project.coffee @@ -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) -> diff --git a/src/packages/command-panel/lib/command-panel-view.coffee b/src/packages/command-panel/lib/command-panel-view.coffee index b87aff9d2..0c8a8ccd0 100644 --- a/src/packages/command-panel/lib/command-panel-view.coffee +++ b/src/packages/command-panel/lib/command-panel-view.coffee @@ -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 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 b0dd65e9e..35742ef46 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 @@ -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() \ No newline at end of file diff --git a/src/packages/command-panel/lib/operation.coffee b/src/packages/command-panel/lib/operation.coffee index af963d8ca..f9b22973c 100644 --- a/src/packages/command-panel/lib/operation.coffee +++ b/src/packages/command-panel/lib/operation.coffee @@ -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}