Skip to content

Commit

Permalink
fix: fix getAllLines bug when the width less than one char
Browse files Browse the repository at this point in the history
  • Loading branch information
forzgc committed Apr 20, 2024
1 parent 5e0fe9b commit a563d5c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ export class MiniPoster {
}
}

if (index === mid) {
mid = index + 1;
}

if (lineClamp === lines.length + 1 && mid < length) {
lines.push(content.slice(index, mid - 1) + '...');
} else {
Expand Down

0 comments on commit a563d5c

Please sign in to comment.