X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTEditorWidget.java;h=a694533bf6df0ed3ee4d6e694f0d1b507deab7a3;hb=03f6ef47b94f4db8f7d19ca1f3fec3a0edc10ed1;hp=0f8f7715d8bf30d632c133d721b4e96a579ca4bb;hpb=e23989a4e74f7a7a08496aac956d1abe429bd6c0;p=nikiroo-utils.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. *