diff --git a/README.md b/README.md index af64814..65bce5f 100644 --- a/README.md +++ b/README.md @@ -58,11 +58,11 @@ what you want. * add source view links, currently you have to use the keyboard shortcut * make the search box and nav bar stretch to fit the window * redundant search results (search "format") -* scroll to top when clicking fresh link. but don't disrupt the already working scroll history * convert TODO comments into roadmap ## Post-Merge Roadmap +* infer comptime_int constants (example: members of `#std.time`) * when global const has a type of `type`, categorize it as a type despite its value - example: `std.DynLib` (requires patching to add type annotation) * show abbreviated doc comments in types and namespaces listings diff --git a/lib/main.js b/lib/main.js index abb6911..29baec8 100644 --- a/lib/main.js +++ b/lib/main.js @@ -102,11 +102,11 @@ updateModuleList(); - window.addEventListener('hashchange', onHashChange, false); + window.addEventListener('popstate', onPopState, false); domSearch.addEventListener('keydown', onSearchKeyDown, false); domSearch.addEventListener('input', onSearchChange, false); window.addEventListener('keydown', onWindowKeyDown, false); - onHashChange(); + onHashChange(null); }); }); @@ -579,8 +579,14 @@ } } - function onHashChange() { + function onHashChange(state) { + history.replaceState({}, ""); navigate(location.hash); + if (state == null) window.scrollTo({top: 0}); + } + + function onPopState(ev) { + onHashChange(ev.state); } function navigate(location_hash) { diff --git a/src/Walk.zig b/src/Walk.zig index 2cb4f60..55276de 100644 --- a/src/Walk.zig +++ b/src/Walk.zig @@ -130,7 +130,7 @@ pub const File = struct { const node_tags = ast.nodes.items(.tag); const node_datas = ast.nodes.items(.data); const main_tokens = ast.nodes.items(.main_token); - log.debug("categorize_expr tag {s}", .{@tagName(node_tags[node])}); + //log.debug("categorize_expr tag {s}", .{@tagName(node_tags[node])}); return switch (node_tags[node]) { .container_decl, .container_decl_trailing,