public static FromByteOffset ( int offset ) : |
||
offset | int | The zero-based byte offset to find. |
return |
/// <summary> /// Finds the position closest to a point on the screen. /// </summary> /// <param name="pt">The client coordinates of the point to test.</param> /// <param name="location">An out parameter to receive the found location.</param> /// <returns> /// If no character is close, or the point is outside the window, this function returns /// false, and the location parameter is set to the start of the document. /// If a location was found, this function returns true, and the location parameter is set /// to the close position. /// </returns> public bool PointToPosClose(Point pt, out TextLocation location) { int offset = Plugin.NppIntf.PointToPosClose(pt); if (offset < 0) { location = TextLocation.Start; return(false); } location = TextLocation.FromByteOffset(offset); return(true); }
/// <summary> /// Finds the position closest to a point on the screen. /// </summary> /// <param name="pt">The client coordinates of the point to test.</param> /// <returns>The zero-based position of the closest character.</returns> public TextLocation PointToPos(Point pt) { return(TextLocation.FromByteOffset(Plugin.NppIntf.PointToPos(pt))); }
/// <summary> /// Gets the position that corresponds to a line and column. /// </summary> /// <param name="line">The one-based line number.</param> /// <param name="column">The one-based column number.</param> /// <returns>The zero-based position.</returns> public TextLocation FindColumn(int line, int column) { return(TextLocation.FromByteOffset(Plugin.NppIntf.FindColumn(line, column))); }
/// <summary> /// Gets the ending position of the specified line, before any line-end characters. /// </summary> /// <param name="line">The one-based line number.</param> /// <returns>The end position of the line.</returns> public TextLocation GetLineEndPos(int line) { return(TextLocation.FromByteOffset(Plugin.NppIntf.GetLineEndPos(line))); }
/// <summary> /// Decrements the location by 1 character position. /// </summary> /// <param name="loc">The location object.</param> /// <returns>A new location object containing the decremented location.</returns> public static TextLocation operator --(TextLocation loc) { return(TextLocation.FromByteOffset(Plugin.NppIntf.MoveOffsetByChars(loc.ByteOffset, 1))); }
/// <summary> /// Moves the text location by a specified number of characters. /// </summary> /// <param name="loc">The origin location.</param> /// <param name="dist">The number of characters to move.</param> /// <returns>A new location object representing the moved location.</returns> public static TextLocation operator +(TextLocation loc, int dist) { return(TextLocation.FromByteOffset(Plugin.NppIntf.MoveOffsetByChars(loc.ByteOffset, dist))); }