From 5ffaab785a2aee39bf5631c6367ee85ee4907a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20B=C3=BChler?= <david.buhler@cea.fr> Date: Thu, 4 Jun 2020 09:49:30 +0200 Subject: [PATCH] [ivette] When jumping to a function, resets the selected marker to null. The ASTinfo component clears the buffer when the selected marker changes and no data is provided (which happens when the marker is null). --- ivette/src/renderer/ASTinfo.tsx | 6 +++--- ivette/src/renderer/ASTview.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ivette/src/renderer/ASTinfo.tsx b/ivette/src/renderer/ASTinfo.tsx index e505f52dbcd..e4754c98f10 100644 --- a/ivette/src/renderer/ASTinfo.tsx +++ b/ivette/src/renderer/ASTinfo.tsx @@ -23,15 +23,15 @@ const ASTinfo = () => { React.useEffect(() => { buffer.clear(); - if (data) { + if (marker && data) { buffer.printTextWithTags(data, { css: 'color: blue' }); } - }, [buffer, data]); + }, [marker, buffer, data]); // Callbacks function onSelection(name: string) { // For now, the only markers are functions. - setSelect({ function: name }); + setSelect({ function: name, marker: null }); } // Component diff --git a/ivette/src/renderer/ASTview.tsx b/ivette/src/renderer/ASTview.tsx index 3fc396103d7..4879b2fd17c 100644 --- a/ivette/src/renderer/ASTview.tsx +++ b/ivette/src/renderer/ASTview.tsx @@ -105,7 +105,7 @@ const ASTview = () => { if (marker && marker.kind === 'function') { const item1 = { label: `Go to definition of ${marker.name}`, - onClick: () => setSelect({ function: marker.name }), + onClick: () => setSelect({ function: marker.name, marker: null }), }; Dome.popupMenu([item1]); } -- GitLab