mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-07 15:37:14 +02:00
Fix file open problem in full screen with Spaces
This fixes a problem when a full screen window was on another Space and files were set to open in the topmost window. Previously, this caused a new window to open on the current Space instead of opening the file in the full screen window on the other Space.
This commit is contained in:
@@ -1390,7 +1390,16 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
- (MMVimController *)topmostVimController
|
||||
{
|
||||
// Find the topmost visible window which has an associated vim controller.
|
||||
// Find the topmost visible window which has an associated vim controller
|
||||
// as follows:
|
||||
//
|
||||
// 1. Search through ordered windows as determined by NSApp. Unfortunately
|
||||
// this method can fail, e.g. if a full screen window is on another
|
||||
// "Space" (in this case NSApp returns no windows at all), so we have to
|
||||
// fall back on ...
|
||||
// 2. Search through all Vim controllers and return the first visible
|
||||
// window.
|
||||
|
||||
NSEnumerator *e = [[NSApp orderedWindows] objectEnumerator];
|
||||
id window;
|
||||
while ((window = [e nextObject]) && [window isVisible]) {
|
||||
@@ -1402,6 +1411,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned i, count = [vimControllers count];
|
||||
for (i = 0; i < count; ++i) {
|
||||
MMVimController *vc = [vimControllers objectAtIndex:i];
|
||||
if ([[[vc windowController] window] isVisible]) {
|
||||
return vc;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user