-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fixed: #2278 Editor should not have upward dependencies on EditorManager #2750
Conversation
|
||
return new Editor(doc, makeMasterEditor, mode, container, range); | ||
$(editor).on("focus", _notifyActiveEditorChanged()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this has any effect: you'll need to modify Editor to actually dispatch a "focus" event, replacing the line that calls _notifyActiveEditorChanged()
. (And then stop exporting _notifyActiveEditorChanged()
from EditorManager).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, once you remove the call from Editor, please also remove the require("editor/EditorManager")
call at top.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already included this in a pull request before but had some serious issues with git so i forgot that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line causes a JSLint error because _notifyActiveEditorChanged
is defined after this call to it. Also, as Peter mentions you can delete line 778:
exports._notifyActiveEditorChanged = _notifyActiveEditorChanged;
@dangoor could you look at this |
@WebsiteDeveloper, I will take a look but it may be a couple of days. I appreciate your help here and will try to get through the review as soon as I can. |
Review complete. Sorry about the delay! I'm at a conference right now and hadn't had a chance to go through this until now. Just the minor changes I mentioned above and this is ready to merge. |
@dangoor ready for final review |
@WebsiteDeveloper looks like there are a lot of files with big no-op diffs (line endings changing?). It might be best if you put up a new pull request with cleaner commits. Also, what are the ramifications of the |
@peterflynn the line ending changes are to normalize all line endings to LF endings |
I have reviewed the changes and everything seems okay. I think the LF normalization for the Brackets repository is fine, but I've asked to see if there are other opinions on the Brackets team. I may need to wait until later in the week to do the merge, because we're in the process of preparing releases. For future pull requests, I'd suggest making a separate branch for individual changes. Git+GitHub makes working with branches pretty easy and it makes merging and reviewing more straightforward. |
Yeah you're right i should have made to branches but i am in the process learning to work effectivly with git |
No worries. In some ways, it's harder from your end because you have to keep stuff off of your master until this lands (though you can keep working from a branch easily enough!) The "create a branch for every little thing" workflow is definitely new if you're used to a system like Subversion, but it works quite well. |
No one seemed opposed to the idea of normalized line endings in our repository, so I was going to go ahead and merge in your change. However, a merge with master needs to happen. A couple of things to note:
Thanks for submitting your more recent pull requests from branches. It's definitely much easier to work with. Hopefully, we'll be all set with this one soon. |
@dangoor i merged master but to the failing unit tests for find i have currently no idea why they fail but find does work on my machine only the unit tests seem to fail |
Does find work on your machine after you've reloaded Brackets with your merged repo (and with caching disabled via the devtools)? For me, find was failing with that code, but not when I switched back to master. |
interestingly it works for me with disabled cache and multiple reloads |
Huh, OK. I'll give your updated version a try in the morning. Maybe I merged something incorrectly. |
I just tried it out, and you're correct. With your updates, the Find feature works fine (I'm not sure what I did wrong!). I have a theory about the test failure. The FindReplace tests invoke the find command and then look for the search bar. The find command calls function _launchFind() {
var editor = EditorManager.getActiveEditor(); My theory is that the old mechanism for setting the active editor worked automatically with the |
somehow that seems to be the problem but i have no idea how to fix it |
I think the issue is this: $(editor).on("focus", function () {
_notifyActiveEditorChanged(this);
}); That's in |
@dangoor we should expose the _notifyActiveEditorChanged function for unit tests only so the createMockEditor can call this function. with this change everything works fine |
Yes, you're right. That was a simple fix. I've gone ahead and made the change and merged this pull request at last. Thanks for working through it with me. |
yeah i'm happy it's finally done. |
Fixed #2278
added focus listener and moved _handleSelectAll() to EditorCommandHandler
@dangoor i opened a new pull request