Ejemplo n.º 1
0
        /// <summary>
        /// Moves caret to next word.
        /// </summary>
        public static void MoveToNextWord(IUserInterface ui)
        {
            Document doc = ui.View.Document;
            int      selBegin, selEnd;

            // if there are something selected, release selection
            doc.GetSelection(out selBegin, out selEnd);
            if (selEnd != selBegin)
            {
                doc.SetSelection(doc.CaretIndex, doc.CaretIndex);
            }

            // then, move caret
            CaretMoveLogic.MoveCaret(CaretMoveLogic.Calc_NextWord, ui);

            // update desired column
            ui.View.SetDesiredColumn();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Moves caret to left.
        /// </summary>
        public static void MoveLeft(IUserInterface ui)
        {
            IView view = ui.View;
            int   selBegin, selEnd;

            // if there are something selected,
            // release selection and set caret at where the selection starts
            view.Document.GetSelection(out selBegin, out selEnd);
            if (selEnd != selBegin)
            {
                view.Document.SetSelection(selBegin, selBegin);
                view.ScrollToCaret();
            }
            // otherwise, move caret left
            else
            {
                CaretMoveLogic.MoveCaret(CaretMoveLogic.Calc_Left, ui);
            }

            // update desired column
            view.SetDesiredColumn();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Moves caret up.
 /// </summary>
 public static void MoveUp(IUserInterface ui)
 {
     // move caret
     CaretMoveLogic.MoveCaret(CaretMoveLogic.Calc_Up, ui);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Moves caret down.
 /// </summary>
 public static void MoveDown(IUserInterface ui)
 {
     // move caret
     CaretMoveLogic.MoveCaret(CaretMoveLogic.Calc_Down, ui);
 }