From b328e601645f6bd8820a42b6b5a31f906d15e5ec Mon Sep 17 00:00:00 2001 From: singerdmx Date: Mon, 21 Dec 2020 23:54:52 -0800 Subject: [PATCH] FIx PreserveLineStyleOnMergeRule --- lib/models/rules/delete.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/models/rules/delete.dart b/lib/models/rules/delete.dart index f255df3a..cac220d1 100644 --- a/lib/models/rules/delete.dart +++ b/lib/models/rules/delete.dart @@ -53,7 +53,7 @@ class PreserveLineStyleOnMergeRule extends DeleteRule { op = itr.next(); String text = op.data is String ? op.data as String : ''; int lineBreak = text.indexOf('\n'); - if (lineBreak < 0) { + if (lineBreak == -1) { delta..retain(op.length); continue; } @@ -68,6 +68,7 @@ class PreserveLineStyleOnMergeRule extends DeleteRule { attributes.addAll(attrs); } delta..retain(lineBreak)..retain(1, attributes); + break; } return delta; }