Represents a point in a buffer in row/column coordinates.
Every public method that takes a point also accepts a point-compatible Array. This means a 2-element array containing Numbers representing the row and column. So the following are equivalent:
new Point(1, 2)
[1, 2] # Point compatible Array
Convert any point-compatible object to a Point.
Argument | Description |
---|---|
|
This can be an object that’s already a Point, in which case it’s simply returned, or an array containing two Numbers representing the row and column. |
|
An optional boolean indicating whether to force the copying of objects that are already points. |
Return values |
---|
Returns: A Point based on the given object. |
Makes this point immutable and returns itself.
Return values |
---|
Returns an immutable version of this Point |
Build and return a new Point by traversing the rows and columns specified by the given point.
This method differs from the direct, vector-style addition offered by ::translate. Rather than adding the rows and columns directly, it derives the new point from traversing in “typewriter space”. At the end of every row traversed, a carriage return occurs that returns the columns to 0 before continuing the traversal.
Argument | Description |
---|---|
|
A Point providing the rows and columns to traverse by. |
Return values |
---|
Returns a Point. |
Return values |
---|
Returns an array of this point’s row and column. |
Return values |
---|
Returns an array of this point’s row and column. |
Return values |
---|
Returns a string representation of the point. |