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 =
| '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