Esempio n. 1
0
        public bool ExecuteCommand(RotatePrimaryCaretNextCommandArgs args, CommandExecutionContext executionContext)
        {
            var broker      = args.TextView.GetMultiSelectionBroker();
            var regionArray = broker.AllSelections.ToArray();

            int oldIndex = 0;

            for (; oldIndex < regionArray.Length; oldIndex++)
            {
                if (regionArray[oldIndex] == broker.PrimarySelection)
                {
                    break;
                }
            }

            int newIndex = Math.Min((oldIndex + 1), regionArray.Length - 1);

            Selection newPrimary = regionArray[newIndex];
            var       result     = broker.TrySetAsPrimarySelection(newPrimary);

            if (result == true)
            {
                broker.TryEnsureVisible(newPrimary, EnsureSpanVisibleOptions.None);
            }

            return(result);
        }
Esempio n. 2
0
        public CommandState GetCommandState(RotatePrimaryCaretNextCommandArgs args)
        {
            var broker = args.TextView.GetMultiSelectionBroker();

            return(broker.HasMultipleSelections ? CommandState.Available : CommandState.Unavailable);
        }