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

            if (broker.HasMultipleSelections)
            {
                Selection toRemove = FindLastSelection(broker);

                if (broker.TryRemoveSelection(toRemove))
                {
                    return(broker.TryEnsureVisible(FindLastSelection(broker), EnsureSpanVisibleOptions.None));
                }
            }
            else if (broker.PrimarySelection.Extent.Length > 0)
            {
                broker.TryPerformActionOnSelection(broker.PrimarySelection, PredefinedSelectionTransformations.ClearSelection, out _);
            }

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

            return(broker.HasMultipleSelections || broker.PrimarySelection.Extent.Length > 0 ? CommandState.Available : CommandState.Unavailable);
        }