Limit tooltip func arg list to 200 chars, wrap in terminal

This commit is contained in:
mattpass
2021-04-25 08:32:36 +01:00
parent 23f86200e0
commit 78e417add4
3 changed files with 13 additions and 4 deletions

View File

@@ -27,7 +27,7 @@ table, caption, tbody, tfoot, thead, tr, th, td {
html, body {width: 100%; height: 100%}
.output {position: absolute; display: block; top: 0; padding: 15px 18px 8px 13px; width: 100%; min-height: 100%; border: 0; background: rgba(0,0,0,0.92); color: #ccc}
.output {position: absolute; display: block; top: 0; padding: 15px 18px 8px 13px; width: 100%; min-height: 100%; border: 0; background: rgba(0,0,0,0.92); color: #ccc; white-space: pre-wrap; word-break: break-all}
.commandLine {width: 100%; padding: 8px 2px 8px 0; color: #fff}
.commandLine .user {display: inline-block; height: 24px; margin-top: -4px; margin-left: -13px; padding: 5px 5px 5px 0; margin-bottom: 5px; background: #b58901; color: #000}
.commandLine .cwd {display: inline-block; height: 24px; margin-top: -4px; padding: 5px 5px 5px 0; margin-bottom: 5px; background: #278bd2; color: #fff}

View File

@@ -761,7 +761,7 @@ var ICEcoder = {
// If we have a single result and the mouse pointer is not over the definition of it (that would be pointless), show tooltip
if (1 === numResults && -1 === [null, "def"].indexOf(cM.getTokenTypeAt(coordsChar))) {
get('tooltip').style.display = "block";
get('tooltip').style.left = (this.mouseX - this.maxFilesW + 10) + "px";
get('tooltip').style.left = (this.mouseX + 10) + "px";
numLintErrors = this.content.contentWindow.document.getElementsByClassName("CodeMirror-lint-tooltip")[0];
numLintErrors = numLintErrors && numLintErrors.childNodes
? numLintErrors.childNodes.length
@@ -771,7 +771,11 @@ var ICEcoder = {
? 18 * numLintErrors
: 0)
) + "px";
get('tooltip').style.zIndex = "1";
get('tooltip').style.zIndex = 1000;
// Limit function args list to 200 char max
if (result.params.length > 200) {
result.params = result.params.substr(0, 200) + "...)";
}
get('tooltip').innerHTML = result.params;
// Else hide it
} else {

View File

@@ -19,7 +19,7 @@ if (file_exists($docRoot . $ICEcoderDir . "/data/index.php")) {
}
// Roughly 1 in 100 index runs, we'll do a full index
if (mt_rand(1,100) === 50) {
if (mt_rand(1, 100) === 50) {
$prevIndexData = [];
}
@@ -119,6 +119,11 @@ function phpGrep($path, $base) {
$functionArgs = str_replace('=', ' = ', $functionArgs);
$functionArgs = preg_replace('/\s+/', ' ', $functionArgs);
// Limit function args list to 200 char max
if (strlen($functionArgs) > 200) {
$functionArgs = substr($functionArgs, 0, 200) . "...)";
}
// Finally, we have our function name and args
$functionText = [
0 => $functionName,