private String decode(String string) { StringBuilder result = new StringBuilder(); for (char c : string.toCharArray()) { result.append(myGraphicSetState.map(c)); } return result.toString(); }
@Override public void setAnsiConformanceLevel(int level) { if (level == 1 || level == 2) { myGraphicSetState.designateGraphicSet(0, CharacterSet.ASCII); // ASCII designated as G0 myGraphicSetState.designateGraphicSet( 1, CharacterSet .DEC_SUPPLEMENTAL); // TODO: not DEC supplemental, but ISO Latin-1 supplemental // designated as G1 mapCharsetToGL(0); mapCharsetToGR(1); } else if (level == 3) { designateCharacterSet(0, 'B'); // ASCII designated as G0 mapCharsetToGL(0); } else { throw new IllegalArgumentException(); } }
public void restoreCursor(@NotNull StoredCursor storedCursor) { myCursorX = storedCursor.getCursorX(); myCursorY = storedCursor.getCursorY(); myStyleState.setCurrent(storedCursor.getTextStyle().clone()); setModeEnabled(TerminalMode.AutoWrap, storedCursor.isAutoWrap()); setModeEnabled(TerminalMode.OriginMode, storedCursor.isOriginMode()); CharacterSet[] designations = storedCursor.getDesignations(); for (int i = 0; i < designations.length; i++) { myGraphicSetState.designateGraphicSet(i, designations[i]); } myGraphicSetState.setGL(storedCursor.getGLMapping()); myGraphicSetState.setGR(storedCursor.getGRMapping()); if (storedCursor.getGLOverride() >= 0) { myGraphicSetState.overrideGL(storedCursor.getGLOverride()); } }
@Override public void reset() { myGraphicSetState.resetState(); myStyleState.reset(); myTerminalTextBuffer.clearAll(); myDisplay.setScrollingEnabled(true); initModes(); initMouseModes(); cursorPosition(1, 1); }
@Override public void restoreCursor() { if (myStoredCursor != null) { restoreCursor(myStoredCursor); } else { // If nothing was saved by DECSC setModeEnabled(TerminalMode.OriginMode, false); // Resets origin mode (DECOM) cursorPosition(1, 1); // Moves the cursor to the home position (upper left of screen). myStyleState.reset(); // Turns all character attributes off (normal setting). myGraphicSetState.resetState(); // myGraphicSetState.designateGraphicSet(0, CharacterSet.ASCII);//Maps the ASCII character set // into GL // mapCharsetToGL(0); // myGraphicSetState.designateGraphicSet(1, CharacterSet.DEC_SUPPLEMENTAL); // mapCharsetToGR(1); //and the DEC Supplemental Graphic set into GR } myDisplay.setCursor(myCursorX, myCursorY); }
@Override public void singleShiftSelect(int num) { myGraphicSetState.overrideGL(num); }
@Override public void designateCharacterSet(int tableNumber, char charset) { GraphicSet gs = myGraphicSetState.getGraphicSet(tableNumber); myGraphicSetState.designateGraphicSet(gs, charset); }
@Override public void mapCharsetToGR(int num) { myGraphicSetState.setGR(num); }