X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTEditorWidget.java;h=a694533bf6df0ed3ee4d6e694f0d1b507deab7a3;hb=1bc08f18257ad47aea41f2c62e7da5d05eb3cc23;hp=0f8f7715d8bf30d632c133d721b4e96a579ca4bb;hpb=e307b724e4e1c5d26043dd9425d13108292c5915;p=fanfix.git diff --git a/src/jexer/TEditorWidget.java b/src/jexer/TEditorWidget.java index 0f8f771..a694533 100644 --- a/src/jexer/TEditorWidget.java +++ b/src/jexer/TEditorWidget.java @@ -277,7 +277,6 @@ public class TEditorWidget extends TWidget { && !keypress.getKey().isCtrl() ) { // Plain old keystroke, process it - // TODO: fix document to use ints, not chars document.addChar(keypress.getKey().getChar()); alignCursor(); } else { @@ -462,6 +461,29 @@ public class TEditorWidget extends TWidget { } } + /** + * Set the current visible column number. 1-based. + * + * @return the visible column number. Column 1 is the first column. + */ + public int getVisibleColumnNumber() { + return leftColumn + 1; + } + + /** + * Set the current visible column number. 1-based. + * + * @param column the new visible column number. Column 1 is the first + * column. + */ + public void setVisibleColumnNumber(final int column) { + assert (column > 0); + if ((column > 0) && (column < document.getLineLengthMax())) { + leftColumn = column - 1; + alignDocument(true); + } + } + /** * Get the current editing column number. 1-based. *