summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/uitext.ml17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/uitext.ml b/src/uitext.ml
index b6571a7..5f615b3 100644
--- a/src/uitext.ml
+++ b/src/uitext.ml
@@ -308,12 +308,21 @@ let interact prilist rilist =
loop (nukeIgnoredRis (ri::prev)) (nukeIgnoredRis ril) in
(* This should work on most terminals: *)
let redisplayri() = overwrite (); displayri ri; display "\n" in
- let actOnMatching f =
+ let actOnMatching ?(change=true) f =
(* [f] can have effects on the ri and return false to discard it *)
+ (* Disabling [change] avoids to redisplay the item, allows [f] to
+ print a message (info or error) on a separate line and repeats
+ instead of going to the next item *)
match !ripred with
- | None -> if f ri
- then begin redisplayri(); next() end
- else begin newLine(); loop prev rest end
+ | None -> if not change then newLine();
+ if f ri
+ then begin
+ if change then begin redisplayri(); next() end
+ else repeat()
+ end else begin
+ if change then newLine();
+ loop prev rest
+ end
| Some test -> newLine();
let filt = fun ri -> if test ri then f ri else true in
loop prev (ri::Safelist.filter filt rest)