Exemple #1
0
        internal override ActionResults Execute(Selection sel, params object[] args)
        {
            var ln = Document.Lines[sel.Caret.Line];

            if (sel.Caret.Col == ln.Length)
            {
                return(base.Execute(sel));
            }

            var aff    = Ed.AffinityManager.GetAffinity(sel.Caret);
            var seps   = aff.NonWordSymbols ?? Ed.EditorSettings.NonWordSymbols;
            var st     = SelectWordCommand.GetStrategy(seps, ln.CharAt(sel.Caret.Col));
            var col    = SelectWordCommand.FindBoundRight(seps, ln, sel.Caret.Col, st);
            var newSel = new Selection(sel.Caret, new Pos(sel.Caret.Line, col));

            redoSel = newSel;
            return(base.Execute(newSel));
        }
Exemple #2
0
        internal static Pos WordRight(EditorControl ctx, Selection sel)
        {
            var caret = sel.Caret;
            var line  = ctx.Buffer.Document.Lines[caret.Line];

            if (caret.Col < line.Length - 1)
            {
                var seps  = ctx.AffinityManager.GetAffinity(caret).GetNonWordSymbols(ctx);
                var c     = line.CharAt(caret.Col);
                var strat = SelectWordCommand.GetStrategy(seps, c);
                var pos   = SelectWordCommand.FindBoundRight(seps, line, caret.Col, strat);
                return(new Pos(caret.Line, pos));
            }
            else
            {
                return(RightCommand.MoveRight(ctx, sel));
            }
        }