{
wrappedMode = wrapped;
}
+
+ /**
+ * Answers the vertical scroll position (0..) to set, given the visible column
+ * that is at top left. Note that if called with the total visible width of
+ * the alignment, this gives the maximum cursor scroll value.
+ *
+ * <pre>
+ * Example:
+ * viewport width 40 columns (0-39, 40-79, 80-119...)
+ * column 0 returns scroll position 0
+ * columns 0-40 return scroll position 1
+ * columns 41-80 return scroll position 2
+ * etc
+ * </pre>
+ *
+ * @param topLeftColumn
+ * (0..)
+ * @return
+ */
+ public int getWrappedScrollPosition(final int topLeftColumn)
+ {
+ int w = getViewportWidth();
+
+ /*
+ * visible whole widths
+ */
+ int scroll = topLeftColumn / w;
+ scroll += topLeftColumn % w > 0 ? 1 : 0;
+
+ return scroll;
+ }
}