private boolean fillColumnAndFieldIndexFromX(int x, CodeDisplayCoordinate coordinate) {
    x = x + currentFirstCharColumn * fontCharWidth;
    int columnstart = 0;
    int characterIndex = 0;
    for (int index = 0; index < codeModel.getNumberOfColumns(); index++) {
      int columnend = columnstart + codeModel.getColumnWidthInCharacters(index) * fontCharWidth;
      if ((x >= columnstart) && (x < columnend)) {
        x = x - columnstart;
        characterIndex = x / fontCharWidth;
        coordinate.setColumn(index);
        coordinate.setFieldIndex(characterIndex);
        return true;
      }
      columnstart = columnend;
    }
    return false;
  }
Updates/rewrites the internal representation of the character buffer (that will be drawn) from
the data model. Updating the character buffer from the data model requires a bit of care: The
model provides a sequence of rows, each divided into a fixed number of columns, and each cell
(identified by a row/column combination) can have multiple lines of text. To properly copy this
into a FormattedCharacterBuffer, the code iterates over all rows first. For each row, it
determines what the maximum number of text lines is (over all columns) - this is needed to
determine the overall height of the row. The individual cells are then filled into the right
row, and everything advances to the next row.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/CodeDisplay/CodeDisplay.java