示例#1
0
文件: TextManager.cs 项目: vvmk/VsVim
        internal bool CloseView(ITextView textView)
        {
            if (textView.IsPeekView())
            {
                return(_sharedService.ClosePeekView(textView));
            }

            if (!_vsAdapter.GetContainingWindowFrame(textView).TryGetValue(out IVsWindowFrame vsWindowFrame))
            {
                return(false);
            }

            // In the case this is a split view then close should close on of the views vs. closing the
            // entire frame
            if (vsWindowFrame.GetCodeWindow().TryGetValue(out IVsCodeWindow vsCodeWindow) && vsCodeWindow.IsSplit())
            {
                return(SendSplit(vsCodeWindow));
            }

            // It's possible for IVsWindowFrame elements to nest within each other.  When closing we want to
            // close the actual tab in the editor so get the top most item
            vsWindowFrame = vsWindowFrame.GetTopMost();

            var value = __FRAMECLOSE.FRAMECLOSE_NoSave;

            return(ErrorHandler.Succeeded(vsWindowFrame.CloseFrame((uint)value)));
        }