lib/osx/sugarcube-repl/repl.rb in sugarcube-3.4.0 vs lib/osx/sugarcube-repl/repl.rb in sugarcube-3.4.1

- old
+ new

@@ -2,15 +2,17 @@ class << Repl def window(index=nil) if index NSApplication.sharedApplication.windows[index] + elsif NSApplication.sharedApplication.keyWindow + NSApplication.sharedApplication.keyWindow + elsif NSApplication.sharedApplication.mainWindow + NSApplication.sharedApplication.mainWindow else - ( - NSApplication.sharedApplication.keyWindow || - NSApplication.sharedApplication.mainWindow || - NSApplication.sharedApplication.windows[0] - ) + NSApplication.sharedApplication.windows.select { |window| + window.contentView != nil && window.contentView.subviews.count > 0 + }.first end end def root window.windowController