Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display the text that was searched for when a match occurs #291

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion flamegraph.pl
Original file line number Diff line number Diff line change
Expand Up @@ -750,13 +750,14 @@ sub flow {
<script type="text/ecmascript">
<![CDATA[
"use strict";
var details, searchbtn, unzoombtn, matchedtxt, svg, searching, currentSearchTerm, ignorecase, ignorecaseBtn;
var details, searchbtn, unzoombtn, matchedtxt, searchedFortxt, svg, searching, currentSearchTerm, ignorecase, ignorecaseBtn;
function init(evt) {
details = document.getElementById("details").firstChild;
searchbtn = document.getElementById("search");
ignorecaseBtn = document.getElementById("ignorecase");
unzoombtn = document.getElementById("unzoom");
matchedtxt = document.getElementById("matched");
searchedFortxt = document.getElementById("searchedFor");
svg = document.getElementsByTagName("svg")[0];
searching = 0;
currentSearchTerm = null;
Expand Down Expand Up @@ -1065,6 +1066,8 @@ sub flow {
searchbtn.firstChild.nodeValue = "Search"
matchedtxt.classList.add("hide");
matchedtxt.firstChild.nodeValue = ""
searchedFortxt.classList.add("hide");
searchedFortxt.firstChiled.nodeValue = ""
}
}
function search(term) {
Expand Down Expand Up @@ -1145,6 +1148,10 @@ sub flow {
var pct = 100 * count / maxwidth;
if (pct != 100) pct = pct.toFixed(1)
matchedtxt.firstChild.nodeValue = "Matched: " + pct + "%";

// Show the text that was searched for.
searchedFortxt.classList.remove("hide");
searchedFortxt.firstChild.nodeValue = "Searched for: " + currentSearchTerm;
}
]]>
</script>
Expand All @@ -1158,6 +1165,7 @@ sub flow {
$im->stringTTF("search", $imagewidth - $xpad - 100, $fontsize * 2, "Search");
$im->stringTTF("ignorecase", $imagewidth - $xpad - 16, $fontsize * 2, "ic");
$im->stringTTF("matched", $imagewidth - $xpad - 100, $imageheight - ($ypad2 / 2), " ");
$im->stringTTF("searchedFor", $xpad, $imageheight - ($ypad2 / 2), " ");

if ($palette) {
read_palette();
Expand Down