git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update main screenshot
[fanfix.git]
/
src
/
jexer
/
backend
/
ECMA48Terminal.java
diff --git
a/src/jexer/backend/ECMA48Terminal.java
b/src/jexer/backend/ECMA48Terminal.java
index 16af9005eca9ce4bc70ccd90951e6e36cd8412e3..191f4ca63ee6173c2aa6f84f4faac3115f802913 100644
(file)
--- a/
src/jexer/backend/ECMA48Terminal.java
+++ b/
src/jexer/backend/ECMA48Terminal.java
@@
-167,6
+167,11
@@
public class ECMA48Terminal extends LogicalScreen
*/
private TResizeEvent windowResize = null;
*/
private TResizeEvent windowResize = null;
+ /**
+ * If true, emit wide-char (CJK/Emoji) characters as sixel images.
+ */
+ private boolean wideCharImages = true;
+
/**
* Window width in pixels. Used for sixel support.
*/
/**
* Window width in pixels. Used for sixel support.
*/
@@
-1373,6
+1378,14
@@
public class ECMA48Terminal extends LogicalScreen
doRgbColor = false;
}
doRgbColor = false;
}
+ // Default to using sixel for full-width characters.
+ if (System.getProperty("jexer.ECMA48.wideCharImages",
+ "true").equals("true")) {
+ wideCharImages = true;
+ } else {
+ wideCharImages = false;
+ }
+
// Pull the system properties for sixel output.
if (System.getProperty("jexer.ECMA48.sixel", "true").equals("true")) {
sixel = true;
// Pull the system properties for sixel output.
if (System.getProperty("jexer.ECMA48.sixel", "true").equals("true")) {
sixel = true;
@@
-1694,7
+1707,11
@@
public class ECMA48Terminal extends LogicalScreen
// Image cell: bypass the rest of the loop, it is not
// rendered here.
// Image cell: bypass the rest of the loop, it is not
// rendered here.
- if (lCell.isImage()) {
+ if ((wideCharImages && lCell.isImage())
+ || (!wideCharImages
+ && lCell.isImage()
+ && (lCell.getWidth() == Cell.Width.SINGLE))
+ ) {
hasImage = true;
// Save the last rendered cell
hasImage = true;
// Save the last rendered cell
@@
-1705,7
+1722,16
@@
public class ECMA48Terminal extends LogicalScreen
continue;
}
continue;
}
- assert (!lCell.isImage());
+ assert ((wideCharImages && !lCell.isImage())
+ || (!wideCharImages
+ && (!lCell.isImage()
+ || (lCell.isImage()
+ && (lCell.getWidth() != Cell.Width.SINGLE)))));
+
+ if (!wideCharImages && (lCell.getWidth() == Cell.Width.RIGHT)) {
+ continue;
+ }
+
if (hasImage) {
hasImage = false;
sb.append(gotoXY(x, y));
if (hasImage) {
hasImage = false;
sb.append(gotoXY(x, y));
@@
-1865,7
+1891,13
@@
public class ECMA48Terminal extends LogicalScreen
}
// Emit the character
}
// Emit the character
- sb.append(Character.toChars(lCell.getChar()));
+ if (wideCharImages
+ // Don't emit the right-half of full-width chars.
+ || (!wideCharImages
+ && (lCell.getWidth() != Cell.Width.RIGHT))
+ ) {
+ sb.append(Character.toChars(lCell.getChar()));
+ }
// Save the last rendered cell
lastX = x;
// Save the last rendered cell
lastX = x;
@@
-1917,7
+1949,10
@@
public class ECMA48Terminal extends LogicalScreen
Cell lCell = logical[x][y];
Cell pCell = physical[x][y];
Cell lCell = logical[x][y];
Cell pCell = physical[x][y];
- if (!lCell.isImage()) {
+ if (!lCell.isImage()
+ || (!wideCharImages
+ && (lCell.getWidth() != Cell.Width.SINGLE))
+ ) {
continue;
}
continue;
}