             viewController.textView?.theme = theme
         }
         self.invalidateSyntaxHighlight()
+    }
+    
+    
+    /// find target EditorViewController to manage split views for action sender
+    func findTargetEditorViewController(for sender: AnyObject?) -> EditorViewController? {
+        
+        var view: NSView? = (sender is NSMenuItem) ? (self.window?.firstResponder as? NSView) : sender as? NSView
+        while view != nil {
+            if view?.identifier == "EditorView" { break }
+            view = view?.superview
+        }
+        
+        guard let editorView = view else { return nil }
+        
+        return self.splitViewController?.viewController(for: editorView)
     }
     
 }

        
        // move focus to the next text view if the view to close has a focus
        if splitViewController.focusedSubviewController == currentEditorViewController {
            let childViewControllers = splitViewController.childViewControllers as! [EditorViewController]
            let deleteIndex = childViewControllers.index(of: currentEditorViewController) ?? 0
            let count = childViewControllers.count
            var index = deleteIndex + 1
            if index >= count {
                index = count - 2
            }
            let newFocusEditorViewController = childViewControllers[index]
            guard newFocusEditorViewController != currentEditorViewController else { return }
            
            self.window?.makeFirstResponder(newFocusEditorViewController.textView)
        }

    /// split editor view
    @IBAction func openSplitTextView(_ sender: AnyObject?) {
        
        guard let currentEditorViewController = self.findTargetEditorViewController(for: sender) else { return }
        
        // end current editing
        NSTextInputContext.current()?.discardMarkedText()
