X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTEditorWidget.java;h=a694533bf6df0ed3ee4d6e694f0d1b507deab7a3;hb=12b90437b5f22c2ae6e9b9b14c3b62b60f6143e5;hp=8b105f8ba62bb2d3222590eceb28d82ab6c57229;hpb=39e863978f5c6de901b05b3ecfaee18aa934663d;p=nikiroo-utils.git diff --git a/src/jexer/TEditorWidget.java b/src/jexer/TEditorWidget.java index 8b105f8..a694533 100644 --- a/src/jexer/TEditorWidget.java +++ b/src/jexer/TEditorWidget.java @@ -207,6 +207,16 @@ public class TEditorWidget extends TWidget { } else if (keypress.equals(kbRight)) { document.right(); alignTopLine(true); + } else if (keypress.equals(kbAltLeft) + || keypress.equals(kbCtrlLeft) + ) { + document.backwardsWord(); + alignTopLine(false); + } else if (keypress.equals(kbAltRight) + || keypress.equals(kbCtrlRight) + ) { + document.forwardsWord(); + alignTopLine(true); } else if (keypress.equals(kbUp)) { document.up(); alignTopLine(false); @@ -267,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 { @@ -452,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. *