do not select the extension of a file path when the move dialog triggered

This commit is contained in:
Corey Johnson
2012-05-01 14:26:45 -07:00
parent 0227b11bf3
commit 17fb34ec96
2 changed files with 7 additions and 3 deletions

View File

@@ -391,11 +391,13 @@ describe "TreeView", ->
treeView.trigger "tree-view:move"
moveDialog = rootView.find(".move-dialog").view()
it "opens a move dialog with the file's current path populated", ->
it "opens a move dialog with the file's current path (excluding extension) populated", ->
extension = fs.extension(filePath)
fileNameWithoutExtension = fs.base(filePath, extension)
expect(moveDialog).toExist()
expect(moveDialog.prompt.text()).toBe "Enter the new path for the file:"
expect(moveDialog.editor.getText()).toBe(project.relativize(filePath))
expect(moveDialog.editor.getSelectedText()).toBe fs.base(filePath)
expect(moveDialog.editor.getSelectedText()).toBe fs.base(fileNameWithoutExtension)
expect(moveDialog.editor.isFocused).toBeTruthy()
describe "when the path is changed and confirmed", ->

View File

@@ -18,8 +18,10 @@ class MoveDialog extends View
relativePath = @project.relativize(@path)
@editor.setText(relativePath)
extension = fs.extension(path)
baseName = fs.base(path)
range = [[0, relativePath.length - baseName.length], [0, relativePath.length]]
range = [[0, relativePath.length - baseName.length], [0, relativePath.length - extension.length]]
@editor.setSelectionBufferRange(range)
confirm: ->