summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorG.raud <graud@gmx.com>2018-01-29 12:50:49 +0100
committerG.raud <graud@gmx.com>2018-01-29 21:42:55 +0100
commit823a62b7c8c0be0ab66da2d30cc8f0c6d2a0228f (patch)
tree83feddbadfdc22490570b22e9a76d5151898953a /src
parent1872a395f1f44766ad99ef2b7d1eccbe2cb44af5 (diff)
downloadunison-823a62b7c8c0be0ab66da2d30cc8f0c6d2a0228f.zip
unison-823a62b7c8c0be0ab66da2d30cc8f0c6d2a0228f.tar.gz
unison-823a62b7c8c0be0ab66da2d30cc8f0c6d2a0228f.tar.bz2
Uitext.interact: define the diff display in a subfunction showdiffs
Diffstat (limited to 'src')
-rw-r--r--src/uitext.ml28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/uitext.ml b/src/uitext.ml
index e5de0af..f5f4196 100644
--- a/src/uitext.ml
+++ b/src/uitext.ml
@@ -247,6 +247,20 @@ let interact prilist rilist =
if not (Prefs.read Globals.batch) then display ("\n" ^ Uicommon.roots2string() ^ "\n");
let (r1,r2) = Globals.roots() in
let (host1, host2) = root2hostname r1, root2hostname r2 in
+ let showdiffs ri =
+ Uicommon.showDiffs ri
+ (fun title text ->
+ try
+ let pager = System.getenv "PAGER" in
+ restoreTerminal ();
+ let out = System.open_process_out pager in
+ Printf.fprintf out "\n%s\n\n%s\n\n" title text;
+ let _ = System.close_process_out out in
+ setupTerminal ()
+ with Not_found ->
+ Printf.printf "\n%s\n\n%s\n\n" title text)
+ (fun s -> Printf.printf "%s\n" s)
+ Uutil.File.dummy in
let rec loop prev =
let rec previous prev ril =
match prev with
@@ -331,19 +345,7 @@ let interact prilist rilist =
(["d"],
("show differences"),
(fun () -> newLine();
- Uicommon.showDiffs ri
- (fun title text ->
- try
- let pager = System.getenv "PAGER" in
- restoreTerminal ();
- let out = System.open_process_out pager in
- Printf.fprintf out "\n%s\n\n%s\n\n" title text;
- let _ = System.close_process_out out in
- setupTerminal ()
- with Not_found ->
- Printf.printf "\n%s\n\n%s\n\n" title text)
- (fun s -> Printf.printf "%s\n" s)
- Uutil.File.dummy;
+ showdiffs ri;
repeat()));
(["x"],
("show details"),