code: private void updateSize() {
          int newLineCount = ActionUtils.getLineCount(pane);
          if (newLineCount == lineCount) {
              return;
          }
          lineCount = newLineCount;
          int h = (int) pane.getPreferredSize().getHeight();
          int d = (int) Math.log10(lineCount) + 1;
          if (d < 1) {
              d = 1;
          }
          int w = d * charWidth + r_margin + l_margin;
          format = "%" + d + "d";
          setPreferredSize(new Dimension(w, h));
          getParent().doLayout();
      }
docs: Update the size of the line numbers based on the length of the document