fjtui/test-width.js

19 lines
865 B
JavaScript
Raw Normal View History

const cols = 100;
const idWidth = 6;
const typeWidth = 5;
const stateWidth = 7;
const authorWidth = 14;
const createdWidth = 12;
const commentsWidth = 6;
const timeWidth = 7;
// Old
const oldTitleWidth = cols - idWidth - typeWidth - stateWidth - authorWidth - createdWidth - commentsWidth - 8;
const oldTotal = 1 + (1+idWidth+1) + (1+typeWidth+1) + (1+stateWidth+1) + (1+oldTitleWidth+1) + (1+authorWidth+1) + (1+createdWidth+1) + (1+commentsWidth+1);
console.log('Old total:', oldTotal, 'cols:', cols);
// New
const newTitleWidth = cols - idWidth - typeWidth - stateWidth - authorWidth - createdWidth - commentsWidth - timeWidth - 9;
const newTotal = 1 + (1+idWidth+1) + (1+typeWidth+1) + (1+stateWidth+1) + (1+newTitleWidth+1) + (1+authorWidth+1) + (1+createdWidth+1) + (1+commentsWidth+1) + (1+timeWidth+1);
console.log('New total:', newTotal, 'cols:', cols);