heightPixels = 400;
}
}
+ if ((params.size() > 2) && (params.get(0).equals("6"))) {
+ if (debugToStderr) {
+ System.err.printf("windowOp text cell pixels: " +
+ "height %s width %s\n",
+ params.get(1), params.get(2));
+ }
+ try {
+ widthPixels = width * Integer.parseInt(params.get(2));
+ heightPixels = height * Integer.parseInt(params.get(1));
+ } catch (NumberFormatException e) {
+ if (debugToStderr) {
+ e.printStackTrace();
+ }
+ }
+ if (widthPixels <= 0) {
+ widthPixels = 640;
+ }
+ if (heightPixels <= 0) {
+ heightPixels = 400;
+ }
+ }
resetParser();
return;
default:
* @return the string to emit to xterm
*/
private String xtermReportWindowPixelDimensions() {
- return "\033[14t";
+ // We will ask for both window and text cell dimensions, and
+ // hopefully one of them will work.
+ return "\033[14t\033[16t";
}
/**
}
image = palette.ditherImage(image);
+ // Collect the raster information
+ int rasterHeight = 0;
+ int rasterWidth = image.getWidth();
+
// Emit the palette, but only for the colors actually used by these
// cells.
boolean [] usedColors = new boolean[sixelPaletteSize];
data += 32;
break;
}
+ if ((currentRow + j + 1) > rasterHeight) {
+ rasterHeight = currentRow + j + 1;
+ }
}
}
assert (data >= 0);
// Kill the very last "-", because it is unnecessary.
sb.deleteCharAt(sb.length() - 1);
+ // Add the raster information
+ sb.insert(0, String.format("\"1;1;%d;%d", rasterWidth, rasterHeight));
+
if (saveInCache) {
// This row is OK to save into the cache.
sixelCache.put(cells, sb.toString());