The unified diff between revisions [28518886..] and [94638968..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "agraph.ml"
# from [a1fbfdb58c3ff99dfde25b729f89c7503c4d5e9b]
# to [8c993476234f16a35bc35ba58fd86388868351aa]
#
# patch "view.ml"
# from [50051d16bb931f1cc3012ad29e3256b5875e3898]
# to [e996eff1992c98cfc0f787d2fa6e804662890253]
#
============================================================
--- agraph.ml a1fbfdb58c3ff99dfde25b729f89c7503c4d5e9b
+++ agraph.ml 8c993476234f16a35bc35ba58fd86388868351aa
@@ -338,10 +338,11 @@ let get_related g rel id =
| `CHILD ->
get_related_ids g CHILD id
| `SIBLINGS ->
- List.concat
- (List.map
- (get_related_ids g CHILD)
- (get_related_ids g PARENT id))
+ list_uniq
+ (List.concat
+ (List.map
+ (get_related_ids g CHILD)
+ (get_related_ids g PARENT id)))
end
let get_node g id =
============================================================
--- view.ml 50051d16bb931f1cc3012ad29e3256b5875e3898
+++ view.ml e996eff1992c98cfc0f787d2fa6e804662890253
@@ -860,7 +860,15 @@ module KeyNav = struct
let navigate_is_sibling k id =
List.exists (fun (i, _) -> i = id) k.keyboard_nav_siblings
- let navigate_choose k current_id direction =
+ let on_same_branch db id =
+ let b_target = Database.fetch_cert_value db id "branch" in
+ fun (id, _) ->
+ let b_node = Database.fetch_cert_value db id "branch" in
+ List.exists
+ (fun b -> List.mem b b_target)
+ b_node
+
+ let navigate_choose k ctrl current_id direction =
match k.keyboard_nav_siblings with
| [] -> None
| [ n ] -> Some n
@@ -873,11 +881,9 @@ module KeyNav = struct
| `NEXT -> locate sx
| `PREV -> locate (List.rev sx)
| `PARENT | `CHILD ->
- match k.previous_selected_node with
- | None -> Some (List.hd sx)
- | Some (p_id, _) ->
- try Some (List.find (fun (id, _) -> id = p_id) sx)
- with Not_found -> Some (List.hd sx)
+ match List.filter (on_same_branch (some ctrl#get_db) current_id) sx with
+ | [] -> Some (List.hd sx)
+ | h :: _ -> Some h
let navigate k ctrl key =
match ctrl#get_selected_node with
@@ -893,7 +899,7 @@ module KeyNav = struct
k.previous_selected_node ;
k.previous_selected_node
| (`NEXT | `PREV) as d when k.keyboard_nav_siblings <> [] ->
- navigate_choose k id d
+ navigate_choose k ctrl id d
| #Viz_types.direction as d ->
match ctrl#get_agraph with
| None -> None
@@ -907,7 +913,7 @@ module KeyNav = struct
| `NEXT | `PREV ->
Agraph.get_siblings graph id in
k.keyboard_nav_siblings <- cnodes ;
- navigate_choose k id d
+ navigate_choose k ctrl id d
let select k id previous_id =
k.previous_selected_node <- previous_id ;