public int Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (this.manager.IsEnabled) { var command = this.manager.GetCommandMetadata((int)nCmdID, pguidCmdGroup); if (command != null) { try { // we did find a match so we execute the corresponding command this.manager.Execute(this.view, command); manager.AfterSearch = false; } catch (Exception ex) { this.manager.UpdateStatus(ex.Message); return(VSConstants.S_FALSE); } // return S_OK to signal we successfully handled the command return(VSConstants.S_OK); } else { // The command was not a command understood by the command manager and therefore not a kill command // so we need to flush any accumulated kill string if (this.IsKillwordFlushCommand(pguidCmdGroup, nCmdID)) { view.FlushKillSring(manager.ClipboardRing); } // Check if we should insert chars multiple times if (pguidCmdGroup == VSConstants.VSStd2K && nCmdID == (uint)VSConstants.VSStd2KCmdID.TYPECHAR && this.manager.UniversalArgument.HasValue && this.manager.UniversalArgument.Value > 1) { var count = this.manager.UniversalArgument.Value; while (count-- > 0) { var result = router.ExecuteCommand(ref pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); if (result != VSConstants.S_OK) { return(result); } } return(VSConstants.S_OK); } else if (pguidCmdGroup == VSConstants.VSStd2K && (nCmdID == (uint)VSConstants.VSStd2KCmdID.ISEARCH || nCmdID == (uint)VSConstants.VSStd2KCmdID.ISEARCHBACK)) { MarkSession.GetSession(view).PushMark(); manager.AfterSearch = true; } } } // if there is no match just pass the command along to the next registered filter return(VSConstants.S_FALSE); }