From a563d5cf6732eb5c3c46819f2ddd47503f92f8f3 Mon Sep 17 00:00:00 2001 From: forzgc Date: Sat, 20 Apr 2024 23:58:30 +0800 Subject: [PATCH] fix: fix getAllLines bug when the width less than one char --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index b7feebe..da73185 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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 {