Skip to content

Commit b739b18

Browse files
Improve compatibility for image() (#39)
Co-authored-by: Sindre Sorhus <[email protected]>
1 parent a5d36d2 commit b739b18

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

base.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ export const image = (data, options = {}) => {
131131
returnValue += ';preserveAspectRatio=0';
132132
}
133133

134-
return returnValue + ':' + Buffer.from(data).toString('base64') + BEL;
134+
const imageBuffer = Buffer.from(data);
135+
136+
// `size` is optional in the spec, but xterm.js requires it.
137+
return returnValue + `;size=${imageBuffer.byteLength}` + ':' + imageBuffer.toString('base64') + BEL;
135138
};
136139

137140
export const iTerm = {

0 commit comments

Comments
 (0)