protected override void OnAddedToEditor(TextEditorData data) { ViEditor.SetMode(ViEditorMode.Normal); SetCaretMode(CaretMode.Block, data); ViActions.RetreatFromLineEnd(data); viTextEditor = data.Parent; if (viTextEditor != null) { statusArea = new ViStatusArea(viTextEditor); } }
public static Action <TextEditorData> GetEditObjectCharAction(char c, Motion motion) { if (motion == Motion.None) { return(GetEditObjectCharAction(c)); } switch (c) { case 'w': return(ViActions.InnerWord); case ')': case '}': case ']': case '>': if (motion == Motion.Inner) { return(ViActions.InnerSymbol(c)); } else if (motion == Motion.Outer) { return(ViActions.OuterSymbol(c)); } else { return(null); } case '"': case '\'': case '`': if (motion == Motion.Inner) { return(ViActions.InnerQuote(c)); } else if (motion == Motion.Outer) { return(ViActions.OuterQuote(c)); } else { return(null); } default: return(null); } }
public void Reset(string message) { Context = ViBuilderContext.Create(this); Message = message; if (Data.Caret.Mode != CaretMode.Block) { Data.Caret.Mode = CaretMode.Block; if (Data.Caret.Column > DocumentLocation.MinColumn) { Data.Caret.Column--; } } ViActions.RetreatFromLineEnd(Data); }
public void OnCaretPositionChanged() { switch (Mode) { case ViEditorMode.Insert: case ViEditorMode.Replace: case ViEditorMode.Visual: return; case ViEditorMode.Normal: ViActions.RetreatFromLineEnd(Data); break; default: Reset(""); break; } }
static bool OpenAbove(ViBuilderContext ctx) { // FIXME: this doesn't work correctly on the first line ctx.RunAction((ViEditor e) => ViActions.Up(e.Data)); return(Open(ctx)); }