Closed mingodad closed 2 years ago
Thank you for the feedback. You can scroll the hidden text into view, right? If so, I don't feel that is necessary.
It'll make several users confused and probably trigger issues related to this.
After search a bit I found this https://stackoverflow.com/a/57166828 and with the changes shown bellow it seems to work fine:
diff --git a/docs/index.js b/docs/index.js
index d85b46c..6d8d0fa 100644
--- a/docs/index.js
+++ b/docs/index.js
@@ -152,6 +152,14 @@ $('#auto-refresh').on('change', () => {
});
$('#parse').on('click', parse);
+//Resize editors to fit their parents
+function resizeEditorsToParent() {
+ code.resize(); code.renderer.updateFull();
+ codeAst.resize(); codeAst.renderer.updateFull();
+ codeAstOptimized.resize(); codeAstOptimized.renderer.updateFull();
+ codeProfile.resize(); codeProfile.renderer.updateFull();
+}
+
// Show windows
function setupToolWindow(lsKeyName, buttonSel, codeSel) {
let show = localStorage.getItem(lsKeyName) === 'true';
@@ -162,6 +170,7 @@ function setupToolWindow(lsKeyName, buttonSel, codeSel) {
show = !show;
localStorage.setItem(lsKeyName, show);
$(codeSel).css({ 'display': show ? 'block' : 'none' });
+ resizeEditorsToParent();
});
}
setupToolWindow('show-ast', '#show-ast', '#code-ast');
Thanks! I merged the code.
Testing this grammar in the playgound:
And this input:
On my browser the text after
"fast"
is not shown because the editor doesn't have the same length of it's parent. The same happen toAST
,Optmized AST
, ...Probably resizing the editors to the length of it's parents (also after opening/closing
AST
, ... ) will solve the problem.