From 1bc08f18257ad47aea41f2c62e7da5d05eb3cc23 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Sat, 24 Aug 2019 00:15:18 -0500 Subject: [PATCH] minor cleanup --- src/jexer/TApplication.java | 3 --- src/jexer/TEditorWidget.java | 24 +++++++++++++++++++++++- src/jexer/TEditorWindow.java | 14 ++++++++++---- src/jexer/tterminal/ECMA48.java | 5 ++++- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index fe90e5d..9d27c10 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -2202,9 +2202,6 @@ public class TApplication implements Runnable { assert (!window.isActive()); if (activeWindow != null) { - // TODO: see if this assertion is really necessary. - // assert (activeWindow.getZ() == 0); - activeWindow.setActive(false); // Increment every window Z that is on top of window 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. * diff --git a/src/jexer/TEditorWindow.java b/src/jexer/TEditorWindow.java index b5c4cf1..d78185c 100644 --- a/src/jexer/TEditorWindow.java +++ b/src/jexer/TEditorWindow.java @@ -220,8 +220,11 @@ public class TEditorWindow extends TScrollableWindow { // Clicked on vertical scrollbar editField.setVisibleRowNumber(getVerticalValue()); } - - // TODO: horizontal scrolling + if (mouse.isMouse1() && mouseOnHorizontalScroller(mouse)) { + // Clicked on horizontal scrollbar + editField.setVisibleColumnNumber(getHorizontalValue()); + setHorizontalValue(editField.getVisibleColumnNumber()); + } } /** @@ -249,8 +252,11 @@ public class TEditorWindow extends TScrollableWindow { // Clicked/dragged on vertical scrollbar editField.setVisibleRowNumber(getVerticalValue()); } - - // TODO: horizontal scrolling + if (mouse.isMouse1() && mouseOnHorizontalScroller(mouse)) { + // Clicked/dragged on horizontal scrollbar + editField.setVisibleColumnNumber(getHorizontalValue()); + setHorizontalValue(editField.getVisibleColumnNumber()); + } } } diff --git a/src/jexer/tterminal/ECMA48.java b/src/jexer/tterminal/ECMA48.java index 361a92f..ca32d20 100644 --- a/src/jexer/tterminal/ECMA48.java +++ b/src/jexer/tterminal/ECMA48.java @@ -6752,17 +6752,20 @@ public class ECMA48 implements Runnable { } // 00-17, 19, 1C-1F, 20-7E --> put - // TODO if (ch <= 0x17) { + // We ignore all DCS except sixel. return; } if (ch == 0x19) { + // We ignore all DCS except sixel. return; } if ((ch >= 0x1C) && (ch <= 0x1F)) { + // We ignore all DCS except sixel. return; } if ((ch >= 0x20) && (ch <= 0x7E)) { + // We ignore all DCS except sixel. return; } -- 2.27.0