IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            // If the notification has occured then there is nothing else to do.  We are done
            if (_vimApplicationSettings.HaveNotifiedBackspaceSetting)
            {
                return null;
            }

            // On the very first IVimBuffer creation the vimrc will be loaded.  Go ahead and
            // attempt to get / create the buffer to ensure the vimrc load has been attempted
            var wpfTextView = wpfTextViewHost.TextView;
            IVimBuffer vimBuffer;
            if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextView, out vimBuffer))
            {
                return null;
            }

            // If there is no vimrc or the load does allow backspace over start then there
            // is no need to display the warning
            if (_vim.GlobalSettings.IsBackspaceStart || _vimApplicationSettings.UseEditorTabAndBackspace)
            {
                return null;
            }

            var editorFormatMap = _editorFormatMapService.GetEditorFormatMap(wpfTextView);
            var linkBanner = new LinkBanner();
            linkBanner.MarginName = Name;
            linkBanner.LinkAddress = "https://github.com/jaredpar/VsVim/wiki/FAQ#wiki-backspace";
            linkBanner.LinkText = "FAQ";
            linkBanner.BannerText = "You may want to change the backspace setting in your vimrc";
            linkBanner.Background = editorFormatMap.GetBackgroundBrush(EditorFormatDefinitionNames.Margin, MarginFormatDefinition.DefaultColor);
            linkBanner.CloseClicked += (sender, e) => { _vimApplicationSettings.HaveNotifiedBackspaceSetting = true; };
            return linkBanner;
        }
Example #2
0
        IWpfTextViewMargin IWpfTextViewMarginProvider.CreateMargin(IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin marginContainer)
        {
            // If the notification has occured then there is nothing else to do.  We are done
            if (_vimApplicationSettings.HaveNotifiedBackspaceSetting)
            {
                return(null);
            }

            // On the very first IVimBuffer creation the vimrc will be loaded.  Go ahead and
            // attempt to get / create the buffer to ensure the vimrc load has been attempted
            var        wpfTextView = wpfTextViewHost.TextView;
            IVimBuffer vimBuffer;

            if (!_vim.TryGetOrCreateVimBufferForHost(wpfTextView, out vimBuffer))
            {
                return(null);
            }

            // If there is no vimrc or the load does allow backspace over start then there
            // is no need to display the warning
            if (_vim.GlobalSettings.IsBackspaceStart || !_vim.VimRcState.IsLoadSucceeded)
            {
                return(null);
            }

            var editorFormatMap = _editorFormatMapService.GetEditorFormatMap(wpfTextView);
            var linkBanner      = new LinkBanner();

            linkBanner.MarginName    = Name;
            linkBanner.LinkAddress   = "https://github.com/jaredpar/VsVim/wiki/FAQ#wiki-backspace";
            linkBanner.LinkText      = "FAQ";
            linkBanner.BannerText    = "You may want to change the backspace setting in your vimrc";
            linkBanner.Background    = editorFormatMap.GetBackgroundBrush(EditorFormatDefinitionNames.Margin, MarginFormatDefinition.DefaultColor);
            linkBanner.CloseClicked += (sender, e) => { _vimApplicationSettings.HaveNotifiedBackspaceSetting = true; };
            return(linkBanner);
        }