diff options
author | G.raud <graud@gmx.com> | 2018-02-05 11:46:33 +0100 |
---|---|---|
committer | G.raud <graud@gmx.com> | 2018-02-05 15:09:40 +0100 |
commit | a73a1ade85913936088d3ae0f0f908026720e12c (patch) | |
tree | 788baf8210939132a9beecc7c3994900e4ee9308 | |
parent | 5b5ce1b3966056e4086e7034162b724ac801cc9a (diff) | |
download | unison-a73a1ade85913936088d3ae0f0f908026720e12c.zip unison-a73a1ade85913936088d3ae0f0f908026720e12c.tar.gz unison-a73a1ade85913936088d3ae0f0f908026720e12c.tar.bz2 |
Uitext.interact: make !ripred a list instead of an option
-rw-r--r-- | src/uitext.ml | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/uitext.ml b/src/uitext.ml index e241224..7d71625 100644 --- a/src/uitext.ml +++ b/src/uitext.ml @@ -300,10 +300,10 @@ let interact prilist rilist = begin Recon.setDirection ri dir `Force; true end | ri -> begin Recon.setDirection ri dir `Prefer; true end in - let ripred = ref None in + let ripred = ref [] in let ritest ri = match !ripred with - None -> true - | Some test -> test ri in + [] -> true + | test::_ -> test ri in let rec loop prev = let rec previous prev ril = match prev with @@ -342,8 +342,8 @@ let interact prilist rilist = let redisplayri() = overwrite (); displayri ri; display "\n" in let setripred p = begin match !ripred with - None -> display " Enabling matching condition\n" | _ -> () end; - ripred := Some p in + [] -> display " Enabling matching condition\n" | _ -> () end; + ripred := [p] in let actOnMatching ?(change=true) ?(fail=Some(fun()->())) f = (* [f] can have effects on the ri and return false to discard it *) (* Disabling [change] avoids to redisplay the item, allows [f] to @@ -354,7 +354,7 @@ let interact prilist rilist = let discard, err = match fail with Some e -> false, e | None -> true, fun()->() in match !ripred with - | None -> if not change then newLine(); + | [] -> if not change then newLine(); let t = f ri in if t || not discard then begin @@ -365,7 +365,7 @@ let interact prilist rilist = if change then newLine(); loop prev rest end - | Some test -> newLine(); + | test::_ -> newLine(); let filt = fun ri -> if test ri then f ri || not discard else true in loop prev (ri::Safelist.filter filt rest) in @@ -507,15 +507,15 @@ let interact prilist rilist = ("invert the matching condition"), (fun () -> newLine(); ripred := begin match !ripred with - None -> display "Matching condition not enabled\n"; None - | Some p -> Some (fun i -> not (p i)) end; + [] -> display "Matching condition not enabled\n"; [] + | p::t -> (fun i -> not (p i))::t end; repeat())); (["U";"$"], ("unmatch all (select current)"), (fun () -> newLine(); begin match !ripred with - None -> display "Matching condition already disabled\n" - | Some _ -> display " Disabling matching condition\n"; ripred := None end; + [] -> display "Matching condition already disabled\n" + | _ -> display " Disabling matching condition\n"; ripred := [] end; repeat())); (["r";"u"], ("revert to " ^ Uutil.myName ^ "'s default recommendation (curr or match)"), |