/// <summary> /// A TextSelection extension method that resets the selection. /// </summary> /// <param name="target"> /// The target to act on. /// </param> /// <param name="originalPoints"> /// The original points. /// </param> /// <returns> /// true if it succeeds, otherwise false. /// </returns> public static bool ResetSelection(this TextSelection target, EditorPoints originalPoints) { target.SetSelection(originalPoints.AnchorPoint, originalPoints.ActivePoint); // Usually called when a process fails. This makes it easier to // reply with false while reseting the seleciton. return(false); }
/// <summary> /// Creates an EditorPoints object from the given TextSelection. /// Normally the process modifies the TextSelection, but if /// keepSelection is set to true, the TextSelection is restored /// before returning to the caller. /// </summary> /// <param name="sel"> /// The TextSelection from which to create the EditorPoints object. /// </param> /// <param name="keepSelection"> /// (optional) Whether to prevent changes to the TextSelection. /// </param> /// <returns> /// The editor points. /// </returns> public static EditorPoints GetEditorPoints(TextSelection sel) { var ep = new EditorPoints(sel); ep.RestoreSelectedText(sel); return(ep); }
/// <summary> /// Creates an EditorPoints object from the given TextSelection. /// Normally the process modifies the TextSelection, but if /// keepSelection is set to true, the TextSelection is restored /// before returning to the caller. /// </summary> /// <param name="sel"> /// The TextSelection from which to create the EditorPoints object. /// </param> /// <param name="keepSelection"> /// (optional) Whether to prevent changes to the TextSelection. /// </param> /// <returns> /// The editor points. /// </returns> public static EditorPoints GetEditorPoints(TextSelection sel) { logger.Trace("Entered GetEditorPoints()"); var ep = new EditorPoints(sel); ep.RestoreSelectedText(sel); return(ep); }
/// <summary> /// A TextSelection extension method that gets editor points. /// </summary> /// <param name="source"> /// The source to act on. /// </param> /// <returns> /// The editor points. /// </returns> public static EditorPoints GetEditorPoints(this TextSelection source) { return(EditorPoints.GetEditorPoints(source)); }