Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Rename config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Jan 5, 2017
1 parent df5cf87 commit a254d94
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/find.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ ProjectFindView = require './project-find-view'
ResultsModel = require './project/results-model'
ResultsPaneView = require './project/results-pane'

# To convert previous (and now unused) config setting "openProjectFindResultsInRightPane"
# Convert old config setting for backward compatibility.
if atom.config.get('find-and-replace.openProjectFindResultsInRightPane')
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'right')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'right')
atom.config.unset('find-and-replace.openProjectFindResultsInRightPane')

module.exports =
Expand Down
2 changes: 1 addition & 1 deletion lib/project-find-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class ProjectFindView extends View

showResultPane: ->
options = {searchAllPanes: true}
openDirection = atom.config.get('find-and-replace.openProjectFindResultsDirection')
openDirection = atom.config.get('find-and-replace.projectSearchResultsPaneSplitDirection')
options.split = openDirection unless openDirection is 'none'
atom.workspace.open(ResultsPaneView.URI, options)

Expand Down
2 changes: 1 addition & 1 deletion lib/project/match-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MatchView extends View
right: 'left'
up: 'down'
down: 'up'
openDirection = atom.config.get('find-and-replace.openProjectFindResultsDirection')
openDirection = atom.config.get('find-and-replace.projectSearchResultsPaneSplitDirection')
options.split = reverseDirections[openDirection] unless openDirection is 'none'
editorPromise = atom.workspace.open(@filePath, options)
editorPromise.then (editor) =>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
"default": false,
"description": "Focus the editor and select the next match when a file search is executed. If no matches are found, the editor will not be focused."
},
"openProjectFindResultsDirection": {
"projectSearchResultsPaneSplitDirection": {
"type": "string",
"default": "none",
"enum": ["none", "right", "down"],
"title": "Direction to open results pane",
"description": "When a project-wide search is executed, open the results in a split pane instead of a tab in the same pane."
"description": "Direction to split the active pane when showing project search results. If 'none', the results will be shown in the active pane."
},
"closeFindPanelAfterSearch": {
"type": "boolean",
Expand Down
14 changes: 7 additions & 7 deletions spec/project-find-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe 'ProjectFindView', ->
atom.project.setPaths([path.join(__dirname, 'fixtures')])
jasmine.attachToDOM(workspaceElement)

atom.config.set('find-and-replace.openProjectFindResultsDirection', 'none')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'none')
activationPromise = atom.packages.activatePackage("find-and-replace").then (options) ->
mainModule = options.mainModule
mainModule.createViews()
Expand Down Expand Up @@ -368,7 +368,7 @@ describe 'ProjectFindView', ->

it "splits when option is right", ->
initialPane = atom.workspace.getActivePane()
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'right')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'right')
projectFindView.findEditor.setText('items')
atom.commands.dispatch(projectFindView[0], 'core:confirm')

Expand All @@ -381,7 +381,7 @@ describe 'ProjectFindView', ->

it "splits when option is bottom", ->
initialPane = atom.workspace.getActivePane()
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'down')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'down')
projectFindView.findEditor.setText('items')
atom.commands.dispatch(projectFindView[0], 'core:confirm')

Expand All @@ -405,7 +405,7 @@ describe 'ProjectFindView', ->
expect(pane1).toBe initialPane

it "can be duplicated on the right", ->
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'right')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'right')
projectFindView.findEditor.setText('items')
atom.commands.dispatch(projectFindView[0], 'core:confirm')

Expand All @@ -430,7 +430,7 @@ describe 'ProjectFindView', ->
expect(resultsPaneView2.querySelector('.preview-count').innerHTML).toEqual resultsPaneView1.querySelector('.preview-count').innerHTML

it "can be duplicated at the bottom", ->
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'down')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'down')
projectFindView.findEditor.setText('items')
atom.commands.dispatch(projectFindView[0], 'core:confirm')

Expand Down Expand Up @@ -1452,7 +1452,7 @@ describe 'ProjectFindView', ->
describe "panel opening", ->
describe "when a panel is already open on the right", ->
beforeEach ->
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'right')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'right')

waitsForPromise ->
atom.workspace.open('sample.js')
Expand Down Expand Up @@ -1485,7 +1485,7 @@ describe 'ProjectFindView', ->

describe "when a panel is already open at the bottom", ->
beforeEach ->
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'down')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'down')

waitsForPromise ->
atom.workspace.open('sample.js')
Expand Down
12 changes: 6 additions & 6 deletions spec/results-view-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -441,19 +441,19 @@ describe 'ResultsView', ->
runs ->
expect(atom.views.getView(editor)).toHaveFocus()

describe "when `openProjectFindResultsDirection` option is none", ->
describe "when `projectSearchResultsPaneSplitDirection` option is none", ->
beforeEach ->
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'none')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'none')

it "does not specify a pane to split", ->
spyOn(atom.workspace, 'open').andCallThrough()
atom.commands.dispatch resultsView.element, 'core:move-down'
atom.commands.dispatch resultsView.element, 'core:confirm'
expect(atom.workspace.open.mostRecentCall.args[1]).toEqual {}

describe "when `openProjectFindResultsDirection` option is right", ->
describe "when `projectSearchResultsPaneSplitDirection` option is right", ->
beforeEach ->
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'right')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'right')

it "always opens the file in the left pane", ->
spyOn(atom.workspace, 'open').andCallThrough()
Expand All @@ -474,9 +474,9 @@ describe 'ResultsView', ->
runs ->
expect(atom.views.getView(editor)).toHaveFocus()

describe "when `openProjectFindResultsDirection` option is down", ->
describe "when `projectSearchResultsPaneSplitDirection` option is down", ->
beforeEach ->
atom.config.set('find-and-replace.openProjectFindResultsDirection', 'down')
atom.config.set('find-and-replace.projectSearchResultsPaneSplitDirection', 'down')

it "always opens the file in the up pane", ->
spyOn(atom.workspace, 'open').andCallThrough()
Expand Down

0 comments on commit a254d94

Please sign in to comment.