예제 #1
0
 public static bool ReplaceChar(ViBuilderContext ctx)
 {
     if (ctx.LastKey.Char != '\0')
     {
         ctx.RunAction((ViEditor ed) => ed.Data.Replace(ed.Data.Caret.Offset, 1, ctx.LastKey.Char.ToString()));
     }
     else
     {
         ctx.SetError("Expecting a character");
     }
     return(true);
 }
예제 #2
0
        public static bool GoToMark(ViBuilderContext ctx)
        {
            char c = ctx.LastKey.Char;
            if (!char.IsLetterOrDigit (c)) {
                ctx.SetError ("Invalid Mark");
                return true;
            }

            ctx.RunAction ((ViEditor ed) => {
                ViMark mark;
                if (ed.Marks.TryGetValue (c, out mark))
                    mark.LoadMark (ed.Data);
                else
                    ed.Reset ("Unknown Mark");
            });
            return true;
        }
예제 #3
0
 static void StartRegisterBuilder(ViBuilderContext ctx, ViBuilder nextBuilder)
 {
     if (ctx.Register != '\0')
     {
         ctx.SetError("Register already set");
         return;
     }
     ctx.Builder = (ViBuilderContext x) => {
         char c = x.LastKey.Char;
         if (!ViEditor.IsValidRegister(c))
         {
             x.SetError("Invalid register");
             return(true);
         }
         x.Register = c;
         x.Builder  = nextBuilder;
         return(true);
     };
 }
예제 #4
0
        public static bool Mark(ViBuilderContext ctx)
        {
            char c = ctx.LastKey.Char;

            if (!char.IsLetterOrDigit(c))
            {
                ctx.SetError("Invalid Mark");
                return(true);
            }

            ctx.RunAction((ViEditor ed) => {
                ViMark mark;
                if (!ed.Marks.TryGetValue(c, out mark))
                {
                    ed.Marks [c] = mark = new ViMark(c);
                }
                mark.SaveMark(ed.Data);
            });
            return(true);
        }
예제 #5
0
        public static bool GoToMark(ViBuilderContext ctx)
        {
            char c = ctx.LastKey.Char;

            if (!char.IsLetterOrDigit(c))
            {
                ctx.SetError("Invalid Mark");
                return(true);
            }

            ctx.RunAction((ViEditor ed) => {
                ViMark mark;
                if (ed.Marks.TryGetValue(c, out mark))
                {
                    mark.LoadMark(ed.Data);
                }
                else
                {
                    ed.Reset("Unknown Mark");
                }
            });
            return(true);
        }
예제 #6
0
 static void StartRegisterBuilder(ViBuilderContext ctx, ViBuilder nextBuilder)
 {
     if (ctx.Register != '\0') {
         ctx.SetError ("Register already set");
         return;
     }
     ctx.Builder = (ViBuilderContext x) => {
         char c = x.LastKey.Char;
         if (!ViEditor.IsValidRegister (c)) {
             x.SetError ("Invalid register");
             return true;
         }
         x.Register = c;
         x.Builder = nextBuilder;
         return true;
     };
 }
예제 #7
0
 public static bool ReplaceChar(ViBuilderContext ctx)
 {
     if (ctx.LastKey.Char != '\0')
         ctx.RunAction ((ViEditor ed) => ed.Data.Replace (ed.Data.Caret.Offset, 1, ctx.LastKey.Char.ToString ()));
     else
         ctx.SetError ("Expecting a character");
     return true;
 }
예제 #8
0
        public static bool Mark(ViBuilderContext ctx)
        {
            char c = ctx.LastKey.Char;
            if (!char.IsLetterOrDigit (c)) {
                ctx.SetError ("Invalid Mark");
                return true;
            }

            ctx.RunAction ((ViEditor ed) => {
                ViMark mark;
                if (!ed.Marks.TryGetValue (c, out mark))
                    ed.Marks [c] = mark = new ViMark (c);
                mark.SaveMark (ed.Data);
            });
            return true;
        }