修复节日是3个字以上的高亮

master
yutent 2022-01-25 19:17:21 +08:00
parent d7ff4db1d3
commit 07a4743895
3 changed files with 12 additions and 9 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "bash-calendar",
"description": "终端版万年历",
"version": "1.2.1",
"version": "1.2.2",
"author": "yutent <yutent.io@gmail.com>",
"bin": {
"calendar": "index.js",

View File

@ -189,15 +189,18 @@ function drawTbody(year, month) {
case 2:
let pad = 5
let space = ''
let padSpace = ' '
if (tmp.lunar) {
pad = (10 - tmp.lunar.length * 2) / 2 - 2
}
if (pad > 0) {
space = ' '.repeat(pad)
} else {
padSpace = padSpace.slice(0, pad)
}
if (tmp.picked) {
tr +=
' ' +
chalk.bgBlue.white.bold(' '.repeat(pad) + tmp.lunar + ' '.repeat(pad)) +
' ' +
VLINE
tr += padSpace + chalk.bgBlue.white.bold(space + tmp.lunar + space) + padSpace + VLINE
} else {
if (tmp.lunar) {
tmp.lunar = tmp.highlight