示例#1
0
        public override VimPoint Move(Interfaces.IVimHost host)
        {
            if (host.IsCurrentPositionAtEndOfLine()) {
                return host.CurrentPosition;
            }

            VimPoint bak = host.CurrentPosition;

            for (int i = 0; i < this.Repeat; i++) {
                do {
                    if (host.IsCurrentPositionAtEndOfLine()) {
                        host.MoveCursor(bak);
                        return host.CurrentPosition;
                    }

                    host.CaretRight();
                    char ch = host.GetCharAtCurrentPosition();

                    if (ch == _toSearch) {
                        break;
                    }
                }
                while (true);
            }

            return host.CurrentPosition;
        }
示例#2
0
        public override bool Apply(Interfaces.IVimHost host)
        {
            string reg_text = _register.GetText(host);
            if (reg_text == null) {
                return false;
            }

            if (_register.IsTextLines) {
                string text = reg_text;
                for (int i = 0; i < (this.Repeat - 1); i++) {
                    text = text + host.LineBreak + reg_text;
                }

                host.OpenLineBelow();
                host.InsertTextAtCurrentPosition(text);
            }
            else {
                string text = "";
                for (int i = 0; i < this.Repeat; i++) {
                    text = text + reg_text;
                }

                host.CaretRight();
                host.InsertTextAtCurrentPosition(text);
            }

            if (host.IsCurrentPositionAtEndOfLine()) {
                host.MoveToEndOfLine();
                host.CaretLeft();
            }

            return true;
        }