// i wish we could simply do th:is: //VsShellUtilities.GetWindowObject(wf).Caption = some caption; // but its impossible. Exception is thrown - invalid operation, bla bla. public static void SetDocumentWindowFrameCaptionWithLabel(this IVsWindowFrame wf, string vanillaTabCaption, string jumpLabel) { //TODO: (check for length (what if vanilla caption is shorter than label & decor ???!!!) var newCaption = PeasyMotionEdAdornment.getDocumentTabCaptionWithLabel(vanillaTabCaption, jumpLabel); wf.SetProperty((int)VsFramePropID.OverrideCaption, newCaption); //Debug.WriteLine($"WindowFrame oldCaption={vanillaTabCaption} => newCaption={newCaption}"); }
public void Deactivate() { ThreadHelper.ThrowIfNotOnUIThread(); if (adornmentMgr != null) { adornmentMgr.view.LostAggregateFocus -= OnTextViewFocusLost; } StopListening2Keyboard(); TryEnableVsVim(); TryEnableViEmu(); adornmentMgr?.Reset(); adornmentMgr = null; activeJumpMode = JumpMode.InvalidMode; statusBar.Clear(); }
#pragma warning restore 649, 169 #region IWpfTextViewCreationListener /// <summary> /// Called when a text view having matching roles is created over a text data model having a matching content type. /// Instantiates a PeasyMotionEdAdornment manager when the textView is created. /// </summary> /// <param name="textView">The <see cref="IWpfTextView"/> upon which the adornment should be placed</param> public void TextViewCreated(IWpfTextView textView) { _ = new PeasyMotionEdAdornment(); }
private void ExecuteCommonJumpCode() { ShowNotificationsIfAny(); #if MEASUREEXECTIME var watch = System.Diagnostics.Stopwatch.StartNew(); #endif textMgr.GetActiveView(1, null, out IVsTextView vsTextView); if (vsTextView == null) { Debug.Fail("MenuItemCallback: could not retrieve current view"); return; } IWpfTextView wpfTextView = editor.GetWpfTextView(vsTextView); if (wpfTextView == null) { Debug.Fail("failed to retrieve current view"); return; } #if MEASUREEXECTIME var watch3 = System.Diagnostics.Stopwatch.StartNew(); #endif if (adornmentMgr != null) { Deactivate(); } #if MEASUREEXECTIME watch3.Stop(); Trace.WriteLine($"PeasyMotion Deactivate(): {watch3.ElapsedMilliseconds} ms"); #endif #if MEASUREEXECTIME var watch2 = System.Diagnostics.Stopwatch.StartNew(); #endif TryDisableVsVim(); #if MEASUREEXECTIME watch2.Stop(); Trace.WriteLine($"PeasyMotion TryDisableVsVim: {watch2.ElapsedMilliseconds} ms"); #endif #if MEASUREEXECTIME var watch7 = System.Diagnostics.Stopwatch.StartNew(); #endif TryDisableViEmu(); #if MEASUREEXECTIME watch7.Stop(); Trace.WriteLine($"PeasyMotion TryDisableViEmu: {watch7.ElapsedMilliseconds} ms"); #endif ITextStructureNavigator textStructNav = this.textStructureNavigatorSelector.GetTextStructureNavigator(wpfTextView.TextBuffer); var args = new PeasyMotionEdAdornmentCtorArgs { vsTextView = vsTextView, wpfView = wpfTextView, textStructNav = textStructNav, jumpMode = activeJumpMode, twoCharSearchJumpKeys = this.userQueryAccumulatedKeyChars?.ToLowerInvariant() }; adornmentMgr = new PeasyMotionEdAdornment(args); ThreadHelper.ThrowIfNotOnUIThread(); CreateInputListener(vsTextView, wpfTextView); wpfTextView.LostAggregateFocus += OnTextViewFocusLost; #if MEASUREEXECTIME watch.Stop(); Trace.WriteLine($"PeasyMotion FullExecTime: {watch.ElapsedMilliseconds} ms"); #endif if (!adornmentMgr.anyJumpsAvailable()) // empty text? no jump labels { Deactivate(); } }