Java Code Examples for io.termd.core.util.Helper#computePosition()

The following examples show how to use io.termd.core.util.Helper#computePosition() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineBuffer.java    From termd with Apache License 2.0 3 votes vote down vote up
/**
 * Compute the position of the char at the specified {@literal offset} of this line buffer given a
 * {@literal width} and a relative {@literal start} position.
 *
 * @param width the screen width
 * @return the height
 */
public Vector getPosition(int offset, int width) {
  if (offset > size) {
    throw new IndexOutOfBoundsException("Offset cannot bebe greater than the buffer size");
  }
  return Helper.computePosition(data, new Vector(0, 0), offset, width);
}
 
Example 2
Source File: LineBuffer.java    From termd with Apache License 2.0 3 votes vote down vote up
/**
 * Compute the position of the char at the specified {@literal offset} of this line buffer given a
 * {@literal width} and a relative {@literal start} position.
 *
 * @param width the screen width
 * @return the height
 */
public Vector getPosition(int offset, int width) {
  if (offset > size) {
    throw new IndexOutOfBoundsException("Offset cannot bebe greater than the buffer size");
  }
  return Helper.computePosition(data, new Vector(0, 0), offset, width);
}