Scroll speed & find on input settings, fix tab sticking on close

This commit is contained in:
mattpass
2021-04-11 10:34:58 +01:00
parent f5c1640dbd
commit da88db20fb
6 changed files with 74 additions and 51 deletions

View File

@@ -1204,7 +1204,8 @@ var ICEcoder = {
this.scrollInt = setInterval(function(ic) {
// Aim for this step to go 1/5th towards the target line we want as next scroll "step"
ic.scrollingOnLine = ic.scrollingOnLine + ((tgtLineNo - ic.scrollingOnLine) / 5);
// 1 = instant, 20 = very slow
ic.scrollingOnLine = ic.scrollingOnLine + ((tgtLineNo - ic.scrollingOnLine) / ICEcoder.goToLineScrollSpeed);
// Scroll on the Y axis to the pixels in this step + 8 to handle margin - 1/10th of editor visible height
thisCM.scrollTo(0, (thisCM.defaultTextHeight() * ic.scrollingOnLine) + 8 - (thisCM.getScrollInfo().clientHeight / 10));
// Clear interval if we're at the target line now
@@ -2818,12 +2819,12 @@ var ICEcoder = {
? "inline-block" : "none";
},
findReplaceOnInput: function() {
// Realtime finding - only action for finding/replacing in current doc
findOnInput: function() {
// Realtime finding - only action for finding in current doc
if ("" !== get('find').value && t['this document'] === document.findAndReplace.target.value) {
ICEcoder.findReplace(get('find').value, true, false, false);
// Considers selecting next on value input, according to user setting
ICEcoder.findReplace(get('find').value, true === ICEcoder.selectNextOnFindInput, false, false);
get("find").focus();
return false;
}
},
@@ -2836,6 +2837,10 @@ var ICEcoder = {
replace = get('replace').value;
results = get('results');
// TODO: This is still a problem if you have unterminated character classes
// Simply enable regex finding and press [ or ( ... { doesn't seem to be a problem
// Solution: We could check also that the number of [] () pairs match
// Return early if we're finding with regex and only have ^ or $ or .*, avoids CPU crash
if (true === parent.ICEcoder.findRegex && "" === find.replace(/\^|\$|\.\*/g, "")) {
results.innerHTML = "No results";
@@ -3885,6 +3890,10 @@ var ICEcoder = {
get('plugins').style.left = "left" === settings.pluginPanelAligned ? "0" : "auto";
get('plugins').style.right = "right" === settings.pluginPanelAligned ? "0" : "auto";
// Enable/disable select next on find input and set goToLine scroll speed
this.selectNextOnFindInput = settings.selectNextOnFindInput;
this.goToLineScrollSpeed = settings.goToLineScrollSpeed;
// Restart bug checking
this.bugFilePaths = settings.bugFilePaths;
this.bugFileCheckTimer = settings.bugFileCheckTimer;
@@ -4502,6 +4511,9 @@ var ICEcoder = {
// Update the title tag to indicate any changes
this.indicateChanges();
// Set bool value to false to avoid being stuck on true
this.overCloseLink = false;
}
// Lastly, set the widths
this.setTabWidths(true);

View File

@@ -140,6 +140,8 @@ if (true === $havePrettier && true === file_exists(dirname(__FILE__) . "/plugins
"ICEcoder.demoMode = " . ($ICEcoder["demoMode"] ? 'true' : 'false') . ";" .
"ICEcoder.tagWrapperCommand = '" . $ICEcoder["tagWrapperCommand"] . "';" .
"ICEcoder.autoComplete = '" . $ICEcoder["autoComplete"] . "';" .
"ICEcoder.selectNextOnFindInput = " . ($ICEcoder["selectNextOnFindInput"] ? 'true' : 'false') . ";" .
"ICEcoder.goToLineScrollSpeed = '" . $ICEcoder["goToLineScrollSpeed"] . "';" .
"ICEcoder.bugFilePaths = ['" . implode("','",$ICEcoder["bugFilePaths"]) . "'];" .
"ICEcoder.bugFileCheckTimer = ".$ICEcoder["bugFileCheckTimer"] . ";" .
"ICEcoder.bugFileMaxLines = " . $ICEcoder["bugFileMaxLines"] . ";" .
@@ -311,7 +313,7 @@ if (true === $havePrettier && true === file_exists(dirname(__FILE__) . "/plugins
<form name="findAndReplace" onsubmit="ICEcoder.findReplace(get('find').value, false, false, false); ICEcoder.getcMInstance().focus(); return false">
<div class="findReplace">
<div class="findRegexToggle" id="findRegexToggle" onclick="ICEcoder.findRegexToggle()" title="RegEx">^$</div><div class="findText"><?php echo $t['Find'];?></div>
<input type="text" name="find" value="" id="find" class="textbox find" oninput="ICEcoder.findReplaceOnInput()">
<input type="text" name="find" value="" id="find" class="textbox find" oninput="ICEcoder.findOnInput()">
<div class="selectWrapper" style="width: 41px">
<select name="connector" onChange="ICEcoder.findReplaceOptions()" style="width: 40px; margin-top: 4px">

View File

@@ -206,7 +206,7 @@ if (true === isset($_GET['target']) && false !== strpos($_GET['target'], "filena
return $ret;
}
// TODO: consider $findText here
// TODO: consider $findText here, is OK?
$results = phpGrep($findText, $docRoot . $iceRoot, $docRoot . $iceRoot);
echo 'resultsDisplay += "' . $results . '";';
?>

View File

@@ -165,13 +165,18 @@ if (true === isset($_GET['tab'])) {
</select>
<br><br>
<h2>go to line</h2><br>
scroll speed<br>
<input type="range" name="goToLineScrollSpeed" id="volume" min="1" max="20" value="<?php echo $ICEcoder["goToLineScrollSpeed"];?>" onchange="showButton()" style="width: 150px"><br>
<div style="position: relative; width: 150px; padding: 0 0 5px 5px; color: #888">instant<div style="position: absolute; top: 0; right: 0">slow</div></div>
</div>
<div style="display: inline-block">
<h2>find &amp; replace</h2><br>
<?php echo $t['when finding in...'];?>:<br>
<input type="text" onkeydown="showButton()" name="findFilesExclude" style="width: 300px" value="<?php echo implode(", ",$ICEcoder["findFilesExclude"]); ?>">
<input type="text" onkeydown="showButton()" name="findFilesExclude" style="width: 300px" value="<?php echo implode(", ",$ICEcoder["findFilesExclude"]); ?>"><br><br>
<input type="checkbox" onclick="showButton()" name="selectNextOnFindInput" value="true"<?php if (true === $ICEcoder["selectNextOnFindInput"]) {echo ' checked';};?>> select next result on find input
<br><br>
<h2><?php echo $t['bug reporting'];?></h2><br>

View File

@@ -28,48 +28,50 @@ if (false === $demoMode && true === isset($_SESSION['loggedIn']) && true === $_S
// Prepare all our vars
$updatedSettings = [
"versionNo" => $currentSettings['versionNo'],
"configCreateDate" => $currentSettings['configCreateDate'],
"root" => xssClean($_POST['root'], "html"),
"checkUpdates" => isset($_POST['checkUpdates']),
"openLastFiles" => isset($_POST['openLastFiles']),
"updateDiffOnSave" => isset($_POST['updateDiffOnSave']),
"languageUser" => $_POST['languageUser'],
"backupsKept" => isset($_POST['backupsKept']),
"backupsDays" => intval($_POST['backupsDays']),
"deleteToTmp" => isset($_POST['deleteToTmp']),
"findFilesExclude" => explode(",", str_replace(" ", "", $_POST['findFilesExclude'])),
"codeAssist" => isset($_POST['codeAssist']),
"visibleTabs" => isset($_POST['visibleTabs']),
"lockedNav" => isset($_POST['lockedNav']),
"tagWrapperCommand" => $_POST['tagWrapperCommand'],
"autoComplete" => $_POST['autoComplete'],
"password" => $currentSettings['password'],
"bannedFiles" => explode(",", str_replace(" ", "", $_POST['bannedFiles'])),
"bannedPaths" => explode(",", str_replace(" ", "", $_POST['bannedPaths'])),
"allowedIPs" => explode(",", str_replace(" ", "", $_POST['allowedIPs'])),
"autoLogoutMins" => intval($_POST['autoLogoutMins']),
"theme" => $_POST['theme'],
"fontSize" => $_POST['fontSize'],
"lineWrapping" => isset($_POST['lineWrapping']),
"lineNumbers" => isset($_POST['lineNumbers']),
"showTrailingSpace" => isset($_POST['showTrailingSpace']),
"matchBrackets" => isset($_POST['matchBrackets']),
"autoCloseTags" => isset($_POST['autoCloseTags']),
"autoCloseBrackets" => isset($_POST['autoCloseBrackets']),
"indentType" => $_POST['indentType'],
"indentAuto" => isset($_POST['indentAuto']),
"indentSize" => intval($_POST['indentSize']),
"pluginPanelAligned" => $_POST['pluginPanelAligned'],
"scrollbarStyle" => $_POST['scrollbarStyle'],
"bugFilePaths" => explode(",", str_replace(" ", "", $_POST['bugFilePaths'])),
"bugFileCheckTimer" => intval($_POST['bugFileCheckTimer']) >= 0 ? intval($_POST['bugFileCheckTimer']) : 0,
"bugFileMaxLines" => intval($_POST['bugFileMaxLines']),
"plugins" => $currentSettings['plugins'],
"tutorialOnLogin" => isset($_POST['tutorialOnLogin']),
"previousFiles" => $currentSettings['previousFiles'],
"last10Files" => $currentSettings['last10Files'],
"favoritePaths" => $currentSettings['favoritePaths'],
"versionNo" => $currentSettings['versionNo'],
"configCreateDate" => $currentSettings['configCreateDate'],
"root" => xssClean($_POST['root'], "html"),
"checkUpdates" => isset($_POST['checkUpdates']),
"openLastFiles" => isset($_POST['openLastFiles']),
"updateDiffOnSave" => isset($_POST['updateDiffOnSave']),
"languageUser" => $_POST['languageUser'],
"backupsKept" => isset($_POST['backupsKept']),
"backupsDays" => intval($_POST['backupsDays']),
"deleteToTmp" => isset($_POST['deleteToTmp']),
"findFilesExclude" => explode(",", str_replace(" ", "", $_POST['findFilesExclude'])),
"codeAssist" => isset($_POST['codeAssist']),
"visibleTabs" => isset($_POST['visibleTabs']),
"lockedNav" => isset($_POST['lockedNav']),
"tagWrapperCommand" => $_POST['tagWrapperCommand'],
"autoComplete" => $_POST['autoComplete'],
"password" => $currentSettings['password'],
"bannedFiles" => explode(",", str_replace(" ", "", $_POST['bannedFiles'])),
"bannedPaths" => explode(",", str_replace(" ", "", $_POST['bannedPaths'])),
"allowedIPs" => explode(",", str_replace(" ", "", $_POST['allowedIPs'])),
"autoLogoutMins" => intval($_POST['autoLogoutMins']),
"theme" => $_POST['theme'],
"fontSize" => $_POST['fontSize'],
"lineWrapping" => isset($_POST['lineWrapping']),
"lineNumbers" => isset($_POST['lineNumbers']),
"showTrailingSpace" => isset($_POST['showTrailingSpace']),
"matchBrackets" => isset($_POST['matchBrackets']),
"autoCloseTags" => isset($_POST['autoCloseTags']),
"autoCloseBrackets" => isset($_POST['autoCloseBrackets']),
"indentType" => $_POST['indentType'],
"indentAuto" => isset($_POST['indentAuto']),
"indentSize" => intval($_POST['indentSize']),
"pluginPanelAligned" => $_POST['pluginPanelAligned'],
"scrollbarStyle" => $_POST['scrollbarStyle'],
"selectNextOnFindInput" => isset($_POST['selectNextOnFindInput']),
"goToLineScrollSpeed" => intval($_POST['goToLineScrollSpeed']),
"bugFilePaths" => explode(",", str_replace(" ", "", $_POST['bugFilePaths'])),
"bugFileCheckTimer" => intval($_POST['bugFileCheckTimer']) >= 0 ? intval($_POST['bugFileCheckTimer']) : 0,
"bugFileMaxLines" => intval($_POST['bugFileMaxLines']),
"plugins" => $currentSettings['plugins'],
"tutorialOnLogin" => isset($_POST['tutorialOnLogin']),
"previousFiles" => $currentSettings['previousFiles'],
"last10Files" => $currentSettings['last10Files'],
"favoritePaths" => $currentSettings['favoritePaths'],
];
if ("" !== $_POST['password']) {
@@ -137,6 +139,8 @@ if (false === $demoMode && true === isset($_SESSION['loggedIn']) && true === $_S
"indentSize: " . $ICEcoder["indentSize"] . ", " .
"pluginPanelAligned: '" . $ICEcoder["pluginPanelAligned"] . "', " .
"scrollbarStyle: '" . $ICEcoder["scrollbarStyle"] . "', " .
"selectNextOnFindInput: " . (true === $ICEcoder["selectNextOnFindInput"] ? "true" : "false") . ", " .
"goToLineScrollSpeed: " . $ICEcoder["goToLineScrollSpeed"] . ", " .
"bugFilePaths: " . $jsBugFilePaths . ", " .
"bugFileCheckTimer: " . $ICEcoder["bugFileCheckTimer"] . ", " .
"bugFileMaxLines: " . $ICEcoder["bugFileMaxLines"] . ", " .

View File

@@ -1,7 +1,7 @@
<?php
/*
a:42:{s:9:"versionNo";s:3:"8.0";s:16:"configCreateDate";i:0;s:4:"root";s:0:"";s:12:"checkUpdates";b:1;s:13:"openLastFiles";b:1;s:16:"updateDiffOnSave";b:1;s:12:"languageUser";s:11:"english.php";s:11:"backupsKept";b:1;s:11:"backupsDays";i:14;s:11:"deleteToTmp";b:1;s:16:"findFilesExclude";a:9:{i:0;s:4:".doc";i:1;s:4:".gif";i:2;s:4:".jpg";i:3;s:5:".jpeg";i:4;s:4:".pdf";i:5;s:4:".png";i:6;s:4:".swf";i:7;s:4:".xml";i:8;s:4:".zip";}s:10:"codeAssist";b:1;s:11:"visibleTabs";b:0;s:9:"lockedNav";b:1;s:17:"tagWrapperCommand";s:8:"ctrl+alt";s:12:"autoComplete";s:8:"keypress";s:8:"password";s:0:"";s:11:"bannedFiles";a:2:{i:0;s:4:".git";i:1;s:12:"node_modules";}s:11:"bannedPaths";a:2:{i:0;s:26:"/var/www/sites/all/modules";i:1;s:28:"/var/www/sites/default/files";}s:10:"allowedIPs";a:1:{i:0;s:1:"*";}s:14:"autoLogoutMins";i:0;s:5:"theme";s:7:"default";s:8:"fontSize";s:4:"13px";s:12:"lineWrapping";b:0;s:11:"lineNumbers";b:1;s:17:"showTrailingSpace";b:1;s:13:"matchBrackets";b:1;s:13:"autoCloseTags";b:1;s:17:"autoCloseBrackets";b:1;s:10:"indentType";s:6:"spaces";s:10:"indentAuto";b:1;s:10:"indentSize";i:4;s:18:"pluginPanelAligned";s:4:"left";s:14:"scrollbarStyle";s:7:"overlay";s:12:"bugFilePaths";a:0:{}s:17:"bugFileCheckTimer";i:0;s:15:"bugFileMaxLines";i:0;s:7:"plugins";a:0:{}s:15:"tutorialOnLogin";b:1;s:13:"previousFiles";a:0:{}s:11:"last10Files";a:0:{}s:13:"favoritePaths";a:0:{}}
a:44:{s:9:"versionNo";s:3:"8.0";s:16:"configCreateDate";i:0;s:4:"root";s:0:"";s:12:"checkUpdates";b:1;s:13:"openLastFiles";b:1;s:16:"updateDiffOnSave";b:1;s:12:"languageUser";s:11:"english.php";s:11:"backupsKept";b:1;s:11:"backupsDays";i:14;s:11:"deleteToTmp";b:1;s:16:"findFilesExclude";a:9:{i:0;s:4:".doc";i:1;s:4:".gif";i:2;s:4:".jpg";i:3;s:5:".jpeg";i:4;s:4:".pdf";i:5;s:4:".png";i:6;s:4:".swf";i:7;s:4:".xml";i:8;s:4:".zip";}s:10:"codeAssist";b:1;s:11:"visibleTabs";b:0;s:9:"lockedNav";b:1;s:17:"tagWrapperCommand";s:8:"ctrl+alt";s:12:"autoComplete";s:8:"keypress";s:8:"password";s:0:"";s:11:"bannedFiles";a:2:{i:0;s:4:".git";i:1;s:12:"node_modules";}s:11:"bannedPaths";a:2:{i:0;s:26:"/var/www/sites/all/modules";i:1;s:28:"/var/www/sites/default/files";}s:10:"allowedIPs";a:1:{i:0;s:1:"*";}s:14:"autoLogoutMins";i:0;s:5:"theme";s:7:"default";s:8:"fontSize";s:4:"13px";s:12:"lineWrapping";b:0;s:11:"lineNumbers";b:1;s:17:"showTrailingSpace";b:1;s:13:"matchBrackets";b:1;s:13:"autoCloseTags";b:1;s:17:"autoCloseBrackets";b:1;s:10:"indentType";s:6:"spaces";s:10:"indentAuto";b:1;s:10:"indentSize";i:4;s:18:"pluginPanelAligned";s:4:"left";s:14:"scrollbarStyle";s:7:"overlay";s:21:"selectNextOnFindInput";b:1;s:19:"goToLineScrollSpeed";i:5;s:12:"bugFilePaths";a:0:{}s:17:"bugFileCheckTimer";i:0;s:15:"bugFileMaxLines";i:0;s:7:"plugins";a:0:{}s:15:"tutorialOnLogin";b:1;s:13:"previousFiles";a:0:{}s:11:"last10Files";a:0:{}s:13:"favoritePaths";a:0:{}}
*/
?>