Commit d5b2f47d authored by Glen Mével's avatar Glen Mével

fix `dump-firefox-session` for when there are several windows

parent e8c396bb
......@@ -552,6 +552,10 @@ let tree_structure : [`Default | `TabGroups | `TreeTabs] ref = ref `Default
let childrens : (id, (id * node) with_index list) Hashtbl.t = Hashtbl.create 10
let groups : group with_index list ref = ref []
let clear () =
Hashtbl.clear childrens ;
groups := []
let add_child parent_id child =
let old_children = Hashtbl.find_opt childrens parent_id or [] in
Hashtbl.replace childrens parent_id (child :: old_children)
......@@ -694,9 +698,11 @@ let () =
(* Finalize groups. *)
let groups = sort_with_indexes !groups in
(* Print the whole forest. *)
Printf.printf "{ WINDOW %u }\n" (window_count + 1) ;
Printf.printf "\n{ WINDOW %u }\n" (window_count + 1) ;
groups |> List.iter begin fun group ->
Printf.printf "\n[%s]\n\n" group.group_name ;
List.iter (print_tree stdout ~indent:1) group.group_tabs ;
end
end ;
(* Clear the global state for subsequent windows. *)
clear () ;
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment