Emoji break wrapWord
Hi there,
If I enable word wrap with columns that have emoji in them, it eats the first letter of the word on the line below... I assume this has something to do with full width calculations.
Example
const table = require("table");
const works = [
["Name", "Number"],
["Some Text", 24],
["Some more text", 22],
["I am a reallylong name", 19],
["I have a super duperlongname", 18],
];
const doesntwork = [
["Name", "Number"],
["๐ฅ Some Text", 24],
["๐ฅ Some more text", 22],
["๐ฅ I am a reallylong name", 19],
["I have a super duperlongname", 18],
];
const config = {
columns: [
{ alignment: "left", width: 15, wrapWord: true },
{ alignment: "right", width: 10, wrapWord: true },
],
header: { alignment: "center", content: "My Table", wrapWord: true },
};
console.log(table.table(works, config));
console.log(table.table(doesntwork, config));
Results
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ My Table โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโข
โ Name โ Number โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ Some Text โ 24 โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ Some more text โ 22 โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ I am a โ 19 โ
โ reallylong name โ โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ I have a super โ 18 โ
โ duperlongname โ โ
โโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ My Table โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโข
โ Name โ Number โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ ๐ฅ Some Text โ 24 โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ ๐ฅ Some more โ 22 โ
โ ext โ โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ ๐ฅ I am a โ 19 โ
โ eallylong name โ โ
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโข
โ I have a super โ 18 โ
โ duperlongname โ โ
โโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโ
Do you have any idea how to remedy this?
Thanks for making this library. It's of great use to me :smile:
Hi @awensaunders, I tested the output on MacOs and it works fine in various applications: the native terminal, iTerm2, and Intellij IDEA terminal. Can you provide some information about your working environment?
I have a similar issue when I save a table in a txt file
The library is expected to run and display in monospace output like the terminal. Is it still out of sync if you change to a monospace font?
Tried a monospace font while dumping the text on a node-canvas and it stills breaks the wrapping, although just a little bit.