private int calculateRealLength(final int position, final int length) {
    return length != -1 ? length : m_text.length() - position;
  }
The functions that modify part of the line take a parameter length that describes how many
characters are changed. This parameter can be -1 to mean "until the end of the line". This
function takes the given length and converts it into the real number of characters to be
modified.

@param position Character index where the modification begins.
@param length Number of characters to modify.
@return The real number of characters to modify.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/zygraph/realizers/ZyLineContent.java