From 9b1f25140e861b72a3b783d52ca7f42e6bd966b2 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Tue, 9 May 2023 22:46:06 +0800 Subject: [PATCH] fix: #1359 empty line wrap count --- app/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils.ts b/app/utils.ts index 43ea796e..1e34a6b3 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -160,13 +160,13 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) { measureDom.style.width = width + "px"; measureDom.innerText = dom.value.trim().length > 0 ? dom.value : "1"; - const lineWrapCount = Math.max(0, dom.value.split("\n").length - 1); + const emptyLineWrap = Math.max(0, dom.value.split("\n\n").length - 1); const height = parseFloat(window.getComputedStyle(measureDom).height); const singleLineHeight = parseFloat( window.getComputedStyle(singleLineDom).height, ); - const rows = Math.round(height / singleLineHeight) + lineWrapCount; + const rows = Math.round(height / singleLineHeight) + emptyLineWrap; return rows; }