diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 6f15abafb7..3d7fa845ef 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -642,7 +642,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, [win setFrameTopLeftPoint:topLeft]; - if ([win frame].origin.y < [[win screen] frame].origin.y) { + NSPoint screenOrigin = [[win screen] frame].origin; + if ([win frame].origin.y < screenOrigin.y) { // Try to avoid shifting the new window downwards if it means that // the bottom of the window will be off the screen. E.g. if the // user has set windows to open maximized in the vertical direction @@ -650,6 +651,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef, topLeft.y = oldTopLeft.y; [win setFrameTopLeftPoint:topLeft]; } + + if ([win frame].origin.y < screenOrigin.y) { + // Move the window to the top of the screen if the bottom of the + // window is still obscured. + topLeft.y = NSMaxY([[win screen] frame]); + [win setFrameTopLeftPoint:topLeft]; + } } if (1 == [vimControllers count]) {