Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Opening multiple files, new attempt #855

Merged
merged 5 commits into from
May 17, 2012
Merged

Conversation

conradz
Copy link
Contributor

@conradz conradz commented May 10, 2012

(Continues pull request #823)

This adds support for opening multiple files, by adding all the files that were selected to the working set and then opening the last file in the editor.

Adds all the files that were selected to the working set
Opens the last file in the editor
}
});
} else {
result = doOpen(fullPath);
}
if (!result) {
result = (new $.Deferred()).reject().promise();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this old code handles the case where the user canceled the dialog. I think with your changes, the method would return a Deferred that never finishes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I fixed this now

if (!result) {
result = (new $.Deferred()).reject().promise();
}

return result;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you're creating a wrapper Deferred above, this should change to return result.promise()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done

@redmunds
Copy link
Contributor

Code looks good. This even works on Mac with no changes to native shell.

@peterflynn
Copy link
Member

I think we're good to merge once that TODO has been removed (and cleaning up the then() if it's not too much trouble).

@conradz
Copy link
Contributor Author

conradz commented May 16, 2012

I removed the TODO comment and clean up the .then now.

@peterflynn
Copy link
Member

Looks great! We can merge this as soon as adobe/brackets-app#121 lands.

@peterflynn
Copy link
Member

I spotted a bug while playing with this, but it requires a bit of thinking about where the fix should go... so rather than hold this up even longer, I'm going to merge it now and file a bug assigned to @conradz for the remaining piece.

peterflynn added a commit that referenced this pull request May 17, 2012
Enable multi-select in File Open dialog
@peterflynn peterflynn merged commit 4a50bf8 into adobe:master May 17, 2012
@peterflynn
Copy link
Member

Ok, so after doing a bit more investigation I've decided not to file a bug. The behavior that seemed wrong is the order multi-selected files are opened in: if I shift+select a range of files named A,B,C,D,E the order they are opened in Brackets is E,A,B,C,D with D as the current file (the second to last file in the range I selected).

Bizarre as this order seems to be, though, every other Windows app I've tried behaves the same way. It doesn't seem compelling enough to do extra work to deviate from that "standard."

@conradz
Copy link
Contributor Author

conradz commented May 17, 2012

During my testing, I did run into that strange behavior. It seems that windows doesn't really care about the order that files are selected, although I never did nail down the exact pattern that you found. I tried to make it select the last file in the array of paths that showOpenDialog returns, but the array isn't in the right order as the files selected. I'd be interested in how this works on a mac, as I can't test it on one yet.

@peterflynn
Copy link
Member

On a Mac it always seems to order the files in the dialog's list view sort order (so, typically alphabetically). Mac apps seem to always select the last one in the list, so I think we're good there.

On Win I can't quite figure out the rules. For a simple shift+select it consistently uses the list view sort order except that the last item clicked is moved to the front of the list -- which is usually completely out of order. But for ctrl+select I can't make sense of what Windows does. Sometimes it seems to list files in the order they were selected (except for the last-clicked item of course), but other times it ignores the click order and always lists files in sort order, like the Mac (except, again, for the last-clicked item). Go figure...

@conradz
Copy link
Contributor Author

conradz commented May 17, 2012

We could sort by name on Windows after the list is returned, although I don't know if it's really that important. It might be nicer to let the user drag the files that are opened to order them in the order that they want them.

@conradz
Copy link
Contributor Author

conradz commented May 17, 2012

@peterflynn I might look into allowing the user to drag the files in the working set. Do you know if there is a chance we could add other libraries, such as the drag functionality in jquery-ui for this?

@peterflynn
Copy link
Member

I don't think we have to worry about fixing up the order on Windows, since Brackets' current behavior (using the order the dialog gives us, however weird it may be) is consistent with all other Win apps I tried.

Re dragging in the working set -- sounds like a good topic to start a discussion on the forum: http://groups.google.com/group/brackets-dev

gideonthomas pushed a commit to gideonthomas/brackets that referenced this pull request Aug 31, 2017
…a WebRTC. (adobe#855)

* Initialized file transfer protocol

* Experimenting with sending files

* Added logic to send and interpret file events

* Shifted to file object to blob

* Fixed inundation

* Added error handling, cleared _received array

* Fixed code inundation

* Shifted to files from blobs

* Implemented review comments

* Fixes typo

* Shifted from timeout to trigger
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants