From: Amélia Coutard-Sander Date: Sun, 12 Jan 2025 15:40:25 +0000 (+0100) Subject: Amélioration du zoom/dézoom X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=1618cd58a1cf8743e2b6a2e78bd9d1c86cbd386f;p=cells.git Amélioration du zoom/dézoom --- diff --git a/bin/modes.ml b/bin/modes.ml index cb347c7..c752918 100644 --- a/bin/modes.ml +++ b/bin/modes.ml @@ -217,7 +217,7 @@ and Normal : (Mode with type initer = unit) = struct let update (EditorState (m, st)) n = let module M = (val m) in let chpos dx dy ({ pos = x, y; _ } as st) = { st with pos = (x + dx, y + dy) } in - let chsize ds ({ size; _ } as st) = { st with size = max (size + ds) 1 } in + let chsize ds ({ size; _ } as st) = { st with size = max (size + ds) 2 } in let chnum d { n } = { n = Some ((Option.value n ~default:0 * 10) + d) } in let ntimes { n } = let rec iter_n n f v = @@ -241,8 +241,8 @@ and Normal : (Mode with type initer = unit) = struct | 'h' -> (EditorState (m, ntimes n (chpos (-1) 0) st), Either.left { n = None }) | 'j' -> (EditorState (m, ntimes n (chpos 0 (-1)) st), Either.left { n = None }) | 'l' -> (EditorState (m, ntimes n (chpos 1 0) st), Either.left { n = None }) - | 'o' -> (EditorState (m, ntimes n (chsize 1) st), Either.left { n = None }) - | 'p' -> (EditorState (m, ntimes n (chsize (-1)) st), Either.left { n = None }) + | 'o' -> (EditorState (m, ntimes n (chsize (max 1 (st.size / 10))) st), Either.left { n = None }) + | 'p' -> (EditorState (m, ntimes n (chsize (-max 1 (st.size / 10))) st), Either.left { n = None }) | _ -> (EditorState (m, st), Either.left { n = None }) end