+ /**
+ * Set the display height.
+ *
+ * @param height the new height
+ */
+ public final void setHeight(final int height) {
+ this.height = height;
+ scrollRegionBottom = height - 1;
+ if (scrollRegionTop >= scrollRegionBottom) {
+ scrollRegionTop = 0;
+ }
+ if (currentState.cursorY >= height) {
+ currentState.cursorY = height - 1;
+ }
+ if (savedState.cursorY >= height) {
+ savedState.cursorY = height - 1;
+ }
+ while (display.size() < height) {
+ DisplayLine line = new DisplayLine(currentState.attr);
+ line.setReverseColor(reverseVideo);
+ display.add(line);
+ }
+ while (display.size() > height) {
+ scrollback.add(display.remove(0));
+ }
+ }
+