diff options
author | G.raud <graud@gmx.com> | 2018-02-05 13:43:27 +0100 |
---|---|---|
committer | G.raud <graud@gmx.com> | 2018-02-05 15:09:40 +0100 |
commit | 5b5ce1b3966056e4086e7034162b724ac801cc9a (patch) | |
tree | 5582e2b94264077bf669c181268477a0b5249457 /src | |
parent | 7e07cff68830c30cf2ac4d4837481ca0bbeee623 (diff) | |
download | unison-5b5ce1b3966056e4086e7034162b724ac801cc9a.zip unison-5b5ce1b3966056e4086e7034162b724ac801cc9a.tar.gz unison-5b5ce1b3966056e4086e7034162b724ac801cc9a.tar.bz2 |
Uitext: new action "backward"
Diffstat (limited to 'src')
-rw-r--r-- | src/uitext.ml | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/uitext.ml b/src/uitext.ml index 8361109..e241224 100644 --- a/src/uitext.ml +++ b/src/uitext.ml @@ -314,11 +314,13 @@ let interact prilist rilist = | [] -> display ("\n" ^ Uicommon.roots2string() ^ "\n"); loop prev ril in let rec forward n prev ril = match n, prev, ril with - n, _, _ when n < 0 -> assert false - | 0, prev, ril -> loop prev ril + 0, prev, ril -> loop prev ril + | n, [], ril when n < 0 -> loop [] ril + | n, pri::pril, ril when n < 0 -> forward (n+1) pril (pri::ril) | _, [], [] -> loop [] [] - | _, pri::pril, [] -> loop pril [pri] - | n, prev, ri::rest -> forward (n-1) (ri::prev) rest in + | n, pri::pril, [] when n > 0 -> loop pril [pri] + | n, prev, ri::rest when n > 0 -> forward (n-1) (ri::prev) rest + | _ -> assert false (* to silence the compiler *) in function [] -> (ConfirmBeforeProceeding, Safelist.rev prev) | ri::rest as ril -> @@ -427,6 +429,10 @@ let interact prilist rilist = ("go forward to the middle of the following items"), (fun () -> newLine(); forward ((Safelist.length ril)/2) prev ril)); + (["6"], + ("go backward to the middle of the preceding items"), + (fun () -> newLine(); + forward (-((Safelist.length prev)+1)/2) prev ril)); (["R"], ("reverse the list"), (fun () -> newLine(); |