Skip to content

Commit

Permalink
Mermaid: Make unreachable highlighting optional
Browse files Browse the repository at this point in the history
  • Loading branch information
xFrednet committed Nov 1, 2024
1 parent c08797d commit 9dca284
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/rt/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace rt::ui
bool draw_immutable_region;
/// Indicates if local functions should be visible
bool draw_funcs;
bool highlight_unreachable = true;

std::vector<objects::DynObject*> error_objects;
std::vector<objects::Edge> error_edges;
Expand Down
8 changes: 5 additions & 3 deletions src/rt/ui/mermaid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ namespace rt::ui

// Give a nice id to each object.
std::map<objects::DynObject*, NodeInfo> nodes;
std::map<objects::Region*, std::vector<std::size_t>> region_strings;
std::map<objects::Region*, RegionInfo> regions;

public:
Expand Down Expand Up @@ -198,8 +197,10 @@ namespace rt::ui
// Footer
out << markers.second;
out
<< (dst->is_immutable() ? ":::immutable" :
(reachable ? "" : ":::unreachable"));
<< (dst->is_immutable() ?
":::immutable" :
(reachable && info->highlight_unreachable ? "" :
":::unreachable"));
out << std::endl;

result = node;
Expand Down Expand Up @@ -503,6 +504,7 @@ namespace rt::ui
{
// Make sure ui doesn't pause
steps += 10;
highlight_unreachable = false;

// Construct message
std::stringstream ss;
Expand Down

0 comments on commit 9dca284

Please sign in to comment.