From 41076a9b2a8971419e1869997bfbd6e52f560b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=E1=BA=A1m=20Ho=C3=A0ng=20Sang?= Date: Fri, 25 Aug 2023 14:23:59 +0700 Subject: [PATCH] Update logic --- lib/src/models/documents/document.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/models/documents/document.dart b/lib/src/models/documents/document.dart index f89a7a19..6266b42b 100644 --- a/lib/src/models/documents/document.dart +++ b/lib/src/models/documents/document.dart @@ -157,15 +157,15 @@ class Document { Style collectStyle(int index, int len) { final res = queryChild(index); // -1 because the cursor is at the part of the line that is not visible - // Bug: When the caret is in the middle of the paragraph - // and at the end of the format string, it will display the wrong state + // Bug: When the caret is in the middle of the paragraph + // and at the end of the format string, it will display the wrong state // of the format button - final isNotLinkStyle = - res.node?.style.attributes[Attribute.link.key]?.value == false; + final isLinkStyle = + res.node?.style.attributes[Attribute.link.key]?.value == true; // In this case, we have an exception, this is a link. // When node is a link we will not -1 return (res.node as Line).collectStyle( - len == 0 && res.node != null && isNotLinkStyle + len == 0 && res.node != null && !isLinkStyle ? res.offset - 1 : res.offset, len);