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

Update editors when containing directory is renamed or removed (redux) #1049

Merged
merged 22 commits into from
Mar 27, 2017

Conversation

BinaryMuse
Copy link

@BinaryMuse BinaryMuse commented Mar 25, 2017

This is another pass at #1044, but basing the work on @Alhadis' changes at #966 (which fit in perfectly with this feature). See the former PR for more details on the feature.

Katrina and I are moving on to other projects, but since we didn't get to this in the past week, I wanted to take care of it now.

@Alhadis, I pulled in the changes from your PR and made some changes on top. Namely:

  • CopyDialog and MoveDialog now take callbacks instead of relying on the emitter directly
  • I've standardized the key names from the new event objects so that if there are two paths they are always initialPath and newPath, and if there is only one it's always path
  • I modified the tests to use the new public methods directly instead of reaching into the emtiter internals

Let me know if that causes any conern for you, and thank you so much for your work on this!

Closes #1044
Closes #966

Fixes #948
Fixes atom/tabs#12
Fixes atom/tabs#413
Fixes atom/atom#9875

/cc @kuychaco

@BinaryMuse
Copy link
Author

@kuychaco This is ready for a review, and subsequently ready for a merge pending @Alhadis' 👀

@Alhadis
Copy link
Contributor

Alhadis commented Mar 27, 2017

CopyDialog and MoveDialog now take callbacks instead of relying on the emitter directly

How does another package respond to these callbacks? It'd seem that an entirely different Dialog instance would need to be created each time.

@BinaryMuse
Copy link
Author

BinaryMuse commented Mar 27, 2017

How does another package respond to these callbacks?

They wouldn't; this is just an implementation detail. Other packages would consume the top-level API.

[Edit] To be clear, I meant that we don't rely on the dialog's emitter; the callbacks supplied still call TreeView's emitter.

@Alhadis
Copy link
Contributor

Alhadis commented Mar 27, 2017

Oh, sorry... I misinterpreted completely.

👍 In which case, looks good to me!

@BinaryMuse BinaryMuse merged commit 9993b8f into master Mar 27, 2017
@disposables.add @onEntryDeleted ({path}) ->
for editor in atom.workspace.getTextEditors()
if editor?.getPath()?.startsWith(path)
editor.destroy()

Choose a reason for hiding this comment

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

Maybe not destroy them if they have unsaved changes?

Copy link
Author

Choose a reason for hiding this comment

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

Hm, this code path didn't change (it was only moved). I'll double check again but I was pretty sure that it left the editor open with unsaved changes.

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, you're right - it definitely does get destroyed. Sounds like a bug to me! I'll check for another issue and if one doesn't exist, create one. Thanks.

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.

4 participants