private void DoAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment var tb = fragment.tb; tb.BeginAutoUndo(); tb.TextSource.Manager.ExecuteCommand(new SelectCommand(tb.TextSource)); if (tb.Selection.ColumnSelectionMode) { var start = tb.Selection.Start; var end = tb.Selection.End; start.iChar = fragment.Start.iChar; end.iChar = fragment.End.iChar; tb.Selection.Start = start; tb.Selection.End = end; } else { tb.Selection.Start = fragment.Start; tb.Selection.End = fragment.End; } tb.InsertText(newText); tb.TextSource.Manager.ExecuteCommand(new SelectCommand(tb.TextSource)); tb.EndAutoUndo(); tb.Focus(); }
private void DoAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment var tb = fragment.tb; tb.Selection.Start = fragment.Start; tb.Selection.End = fragment.End; tb.InsertText(newText); tb.Focus(); }
private void DoAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment var tb = fragment.tb; // < By WendyH --------------------------- if (tb.ToolTip4Function.Visible) { Menu.AfterComplete = true; } if (fragment.CharBeforeStart == '=') { newText = " " + newText; } int iLine = fragment.Start.iLine; int iChar = fragment.Start.iChar; HMSItem hmsItem = item as HMSItem; if ((hmsItem != null) && ((hmsItem.Kind == DefKind.Property) || (hmsItem.Kind == DefKind.Variable)) && !HMS.TypeIsClass(hmsItem.Type)) { Range fwords = fragment.GetFragmentLookedLeft(); var f = new Range(tb, new Place(0, iLine), new Place(fwords.Start.iChar, iLine)); string line = f.Text.Trim(); if (line.Length == 0) { newText += (tb.Language == Language.PascalScript) ? " := " : " = "; } } // > By WendyH --------------------------- tb.BeginAutoUndo(); tb.TextSource.Manager.ExecuteCommand(new SelectCommand(tb.TextSource)); if (tb.Selection.ColumnSelectionMode) { var start = tb.Selection.Start; var end = tb.Selection.End; start.iChar = fragment.Start.iChar; end.iChar = fragment.End.iChar; tb.Selection.Start = start; tb.Selection.End = end; } else { tb.Selection.Start = fragment.Start; tb.Selection.End = fragment.End; } tb.InsertText(newText); tb.TextSource.Manager.ExecuteCommand(new SelectCommand(tb.TextSource)); tb.EndAutoUndo(); tb.Focus(); }
private void DoAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment var tb = fragment.tb; if (tb.Selection.ColumnSelectionMode) { var start = tb.Selection.Start; var end = tb.Selection.End; start.iChar = fragment.Start.iChar; end.iChar = fragment.End.iChar; tb.Selection.Start = start; tb.Selection.End = end; } else { tb.Selection.Start = fragment.Start; tb.Selection.End = fragment.End; } tb.InsertText(newText); tb.Focus(); }
private void DoAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment var tb = fragment.tb; // < By WendyH --------------------------- if (tb.ToolTip4Function.Visible) Menu.AfterComplete = true; if (fragment.CharBeforeStart == '=') newText = " " + newText; int iLine = fragment.Start.iLine; int iChar = fragment.Start.iChar; HMSItem hmsItem = item as HMSItem; if ((hmsItem != null) && ((hmsItem.Kind == DefKind.Property) || (hmsItem.Kind == DefKind.Variable)) && !HMS.TypeIsClass(hmsItem.Type)) { Range fwords = fragment.GetFragmentLookedLeft(); var f = new Range(tb, new Place(0, iLine), new Place(fwords.Start.iChar, iLine)); string line = f.Text.Trim(); if (line.Length == 0) newText += (tb.Language == Language.PascalScript) ? " := " : " = "; } // > By WendyH --------------------------- tb.BeginAutoUndo(); tb.TextSource.Manager.ExecuteCommand(new SelectCommand(tb.TextSource)); if (tb.Selection.ColumnSelectionMode) { var start = tb.Selection.Start; var end = tb.Selection.End; start.iChar = fragment.Start.iChar; end.iChar = fragment.End.iChar; tb.Selection.Start = start; tb.Selection.End = end; } else { tb.Selection.Start = fragment.Start; tb.Selection.End = fragment.End; } tb.InsertText(newText); tb.TextSource.Manager.ExecuteCommand(new SelectCommand(tb.TextSource)); tb.EndAutoUndo(); tb.Focus(); }
private void DoAutocomplete(AutocompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment var box = fragment.tb; // < By WendyH --------------------------- if (box.ToolTip4Function.Visible) Menu.AfterComplete = true; if (fragment.CharBeforeStart == '=') newText = " " + newText; int iLine = fragment.Start.iLine; HMSItem hmsItem = item as HMSItem; if (hmsItem != null) { if (((hmsItem.Kind == DefKind.Property) || (hmsItem.Kind == DefKind.Variable)) && !HMS.TypeIsClass(hmsItem.Type)) { Range fwords = fragment.GetFragmentLookedLeft(); var f = new Range(box, new Place(0, iLine), new Place(fwords.Start.iChar, iLine)); string line = f.Text.Trim(); if ((line.Length == 0) && (box.Lines[iLine].IndexOf('=') < 0)) newText += (box.Language == Language.PascalScript) ? " := " : " = "; } } if (box.KeywordsToLowcase) { if (HMS.WordIsKeyword(newText)) newText = newText.ToLower(); } // > By WendyH --------------------------- box.BeginAutoUndo(); box.BeginUpdate(); try { box.TextSource.Manager.ExecuteCommand(new SelectCommand(box.TextSource)); if (box.Selection.ColumnSelectionMode) { var start = box.Selection.Start; var end = box.Selection.End; start.iChar = fragment.Start.iChar; end .iChar = fragment.End .iChar; box.Selection.Start = start; box.Selection.End = end; } else { box.Selection.Start = fragment.Start; box.Selection.End = fragment.End; } box.InsertText(newText); box.TextSource.Manager.ExecuteCommand(new SelectCommand(box.TextSource)); } finally { box.EndUpdate(); box.EndAutoUndo(); } if ((hmsItem != null) && (hmsItem.Params.Count > 0)) { if (HMSEditor.ActiveEditor != null) HMSEditor.ActiveEditor.WasCommaOrBracket = true; } box.Focus(); }