From 1a185ff53a0949ac47d4fe7bd7c10fbfd603c10f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr>
Date: Thu, 24 Mar 2022 15:47:48 +0100
Subject: [PATCH] [ivette] Minor simplifications.

---
 ivette/src/frama-c/kernel/ASTinfo.tsx | 2 +-
 ivette/src/frama-c/richtext.tsx       | 6 ++----
 src/plugins/server/kernel_ast.mli     | 7 +++----
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/ivette/src/frama-c/kernel/ASTinfo.tsx b/ivette/src/frama-c/kernel/ASTinfo.tsx
index e03a21f7b2d..e538e042627 100644
--- a/ivette/src/frama-c/kernel/ASTinfo.tsx
+++ b/ivette/src/frama-c/kernel/ASTinfo.tsx
@@ -269,8 +269,8 @@ function openFilter(
   filter: string,
   onChange: (f: string) => void,
 ): void {
+  const fs = filter.split(':');
   const menuItems = infos.map((info) => {
-    const fs = filter.split(':');
     const checked = !fs.some((m) => m === info.id);
     const onClick = (): void => {
       const newFs =
diff --git a/ivette/src/frama-c/richtext.tsx b/ivette/src/frama-c/richtext.tsx
index de36f8f01b2..3a9c72c6c7c 100644
--- a/ivette/src/frama-c/richtext.tsx
+++ b/ivette/src/frama-c/richtext.tsx
@@ -53,17 +53,15 @@ export function printTextWithTags(
   options?: DomeBuffers.MarkerProps,
 ): void {
   if (Array.isArray(text)) {
-    let marker = false;
     const tag = text[0];
-    if (typeof (tag) === 'string') {
+    const marker = typeof (tag) === 'string';
+    if (marker) {
       buffer.openTextMarker({ id: tag, ...options ?? {} });
-      marker = true;
     }
     for (let k = marker ? 1 : 0; k < text.length; k++) {
       printTextWithTags(buffer, text[k], options);
     }
     if (marker) {
-      marker = false;
       buffer.closeTextMarker();
     }
   } else if (typeof text === 'string') {
diff --git a/src/plugins/server/kernel_ast.mli b/src/plugins/server/kernel_ast.mli
index a859ea12811..e18092b2f9e 100644
--- a/src/plugins/server/kernel_ast.mli
+++ b/src/plugins/server/kernel_ast.mli
@@ -72,12 +72,11 @@ sig
      Registers a marker information printer.
      Identifier [id] shall be unique.
      Label [label] shall be very short.
-     Description shall succintly describe the kind of information.
+     Description shall succinctly describe the kind of information.
      If the optional [enable] function is provided, the information printer is
      only used when [enable ()] returns true.
-     The printer is allowed to raise [Not_found] exception,
-     which is interpreted as there is no information of this kind for
-     the localizable.
+     The printer is allowed to raise [Not_found] exception when there is no
+     information for the localizable.
   *)
   val register :
     id:string -> label:string -> title:string -> ?enable:(unit -> bool) ->
-- 
GitLab