public void ResetHighlight() { if (selected) { highlight = LinkHighlightMode.Selected; } else { highlight = LinkHighlightMode.None; } }
private bool ParseMarkdownLink(string v, LinkHighlightMode lm, out int lenPrefix, out int lenCore, out int lenSuffix) { var i = 0; var posCoreStart = -1; var posCoreEnd = -1; lenPrefix = lenCore = lenSuffix = -1; if (v.Length == 0) { return(false); } if (v[0] != '[') { return(false); } i++; for (;;) { if (i >= v.Length) { return(false); } if (v[i] == '[') { return(false); } if (v[i] == ']') { break; } i++; } i++; if (i >= v.Length) { return(false); } if (v[i] != '(') { return(false); } posCoreStart = i; i++; for (; ;) { if (i >= v.Length) { return(false); } if (v[i] == '(') { return(false); } if (v[i] == ')') { posCoreEnd = i; break; } i++; } i++; while (posCoreStart < i - 1 && v[posCoreStart + 1] == ' ') { posCoreStart++; } while (posCoreEnd > 0 && v[posCoreEnd - 1] == ' ') { posCoreEnd--; } lenPrefix = posCoreStart + 1; lenCore = posCoreEnd - lenPrefix; lenSuffix = i - (lenPrefix + lenCore); if (lm == LinkHighlightMode.Disabled) { lenPrefix += lenCore; lenCore = 0; } else { var core = v.Substring(lenPrefix, lenCore); var urlmatch = GetURLMatchingRegex().Match(core); if (urlmatch.Success && urlmatch.Groups[0].Value == core) { // url found ... all is good } else { lenPrefix += lenCore; lenCore = 0; } } return(true); }
void DrawSelectedBezier(Vector3 startPos, Vector3 endPos, Vector3 startTan, Vector3 endTan, ColorSchemeName colorSchemeName, int width, LinkHighlightMode highlight) { switch (highlight) { case LinkHighlightMode.Selected: Handles.DrawBezier(startPos, endPos, startTan, endTan, ColorTheme.selectedColor, null, width + 3); break; case LinkHighlightMode.Delete: case LinkHighlightMode.DeleteAndReset: Handles.DrawBezier(startPos, endPos, startTan, endTan, ColorTheme.deletedColor, null, width + 2); break; default: break; } Color c = ColorTheme.GetLinkColor(colorSchemeName); Handles.DrawBezier(startPos, endPos, startTan, endTan, c, null, width); }