Bits are decoded per TS 102 223 5.2; the hex field is authoritative and bytes/bits outside the table are preserved as-is.
-
-
-
-
@@ -1259,7 +1263,7 @@ function switchTab(name) {
if (name === 'c-apdu') cApduSwitchSubtab('sim');
else if (name === 'scp80') setHelpAnchor(scp80HelpAnchor);
else if (name === 'cards') { cardsRender(); setHelpAnchor('cards'); }
- else if (name === 'pysim') setHelpAnchor(pysimHelpAnchor);
+ else if (name === 'pysim') { setHelpAnchor(pysimHelpAnchor); pysimFsFitTree(); }
else if (name === 'profiler') { profilerSetView('list'); setHelpAnchor('profiler'); }
else if (name === 'phone') phoneSwitchSubtab('phone');
else if (name === 'scp81') scp81Enter();
@@ -6157,6 +6161,7 @@ function pysimSwitchSubtab(name) {
});
pysimHelpAnchor = {cmd:'pysim-cmdline', apdu:'raw-apdu', files:'file-manager'}[name] || 'card-reader';
setHelpAnchor(pysimHelpAnchor);
+ if (name === 'files') pysimFsFitTree();
}
function pysimCmdKeydown(e) {
@@ -6437,8 +6442,10 @@ function pysimFsSelectBody(node) {
function pysimFsProbeUi(text, stopLabel) {
const status = document.getElementById('pysim-fs-probe-status');
if (status) {
+ const wasVisible = !status.classList.contains('hidden');
status.textContent = text;
status.classList.toggle('hidden', !text);
+ if (wasVisible !== !text) pysimFsFitTree();
}
const btn = document.getElementById('pysim-fs-probe-btn');
if (btn) {
@@ -6504,10 +6511,23 @@ async function pysimFsProbeAll() {
pysimFsProbeUi(summary, false);
}
+function pysimFsFitTree() {
+ // Cap the tree to the space actually left below its top edge, minus a
+ // small gap, so the page itself never grows a scrollbar (the inline
+ // 65vh style is only the no-JS fallback).
+ const tree = document.getElementById('pysim-fs-tree');
+ const box = tree && tree.parentElement;
+ if (!box || box.offsetParent === null) return;
+ const top = box.getBoundingClientRect().top + window.scrollY;
+ const avail = Math.round(window.innerHeight - top - 12);
+ box.style.maxHeight = Math.max(200, avail) + 'px';
+}
+
function pysimFsRenderTree() {
const el = document.getElementById('pysim-fs-tree');
if (!pysimFsTreeRoot) { el.innerHTML = '(loading)'; return; }
el.innerHTML = pysimFsRenderNode(pysimFsTreeRoot, 0);
+ pysimFsFitTree();
}
function pysimFsRenderNode(node, depth) {
@@ -10824,6 +10844,7 @@ snapshotsLoad();
document.querySelectorAll('.pysim-subtab').forEach(btn => {
btn.addEventListener('click', () => pysimSwitchSubtab(btn.dataset.pysimSub));
});
+window.addEventListener('resize', pysimFsFitTree);
// ===== i18n =====
const LANG_RU = {
diff --git a/frontend/sw.js b/frontend/sw.js
index 26cac1e..59f95a8 100644
--- a/frontend/sw.js
+++ b/frontend/sw.js
@@ -1,4 +1,4 @@
-const CACHE = 'otaman-v174';
+const CACHE = 'otaman-v175';
const URLS = [
'index.html',
'help.html',
diff --git a/frontend/tests/fs_probe.test.js b/frontend/tests/fs_probe.test.js
index d8b446f..1f40d45 100644
--- a/frontend/tests/fs_probe.test.js
+++ b/frontend/tests/fs_probe.test.js
@@ -22,7 +22,7 @@ function extractFunc(src, name) {
}
let code = 'var pysimFsTreeRoot = null;\nvar _pysimFsProbe = null;\nvar pysimFsSort = "fid";\n';
-for (const fn of ['getParentSel', 'getParentPath', 'pysimFsSortChildren', 'pysimFsLoadChildren', 'pysimFsSelectBody', 'pysimFsProbeUi', 'pysimFsProbeAll']) {
+for (const fn of ['getParentSel', 'getParentPath', 'pysimFsSortChildren', 'pysimFsLoadChildren', 'pysimFsSelectBody', 'pysimFsFitTree', 'pysimFsProbeUi', 'pysimFsProbeAll']) {
code += extractFunc(html, fn) + '\n';
}
code += 'globalThis.esc = s => s;\nglobalThis.t = s => s;\nglobalThis.pysimCustomInject = () => {};\n';
diff --git a/frontend/tests/html.test.js b/frontend/tests/html.test.js
index e46b0ff..0d145f8 100644
--- a/frontend/tests/html.test.js
+++ b/frontend/tests/html.test.js
@@ -95,6 +95,10 @@ test('file manager keeps sort/probe controls above the scrolling tree', () => {
assert.ok(html.indexOf('id="pysim-fs-probe-btn"') < html.indexOf('id="pysim-fs-tree"'));
assert.ok(html.indexOf('pysim-fs-sort-pill') < html.indexOf('id="pysim-fs-tree"'));
assert.match(html, /style="max-height:65vh"[^>]*>\s*
/);
+ // the runtime fit caps it to the free viewport space; 65vh stays only as
+ // the no-JS fallback
+ assert.match(html, /function pysimFsFitTree\(/);
+ assert.match(html, /addEventListener\('resize', pysimFsFitTree\)/);
});
test('custom-files init runs after the language init', () => {