public static void InsertPrediction(UI.CodeField field, string prediction) { int i = field.caretPosition - 1; int cuttoff = 0; int caretPosition = field.caretPosition; while (i >= 0) { if (field.text[i] == '.') { break; } if (field.text[i] == prediction[0]) { cuttoff++; break; } i--; cuttoff++; } field.text = field.text.Insert(field.caretPosition, prediction.Substring(cuttoff)); if (!field.isFocused) { field.Select(); field.ActivateInputField(); } field.caretPosition = caretPosition + (prediction.Length - cuttoff); }
public static string[] PredictCode(UI.CodeField field, CodeHelper codeHelper) { if (field.isFocused) { return(PredictCode(field.text, field.caretPosition, codeHelper)); } else { return(emptyList); } }