Decrease FPS

This commit is contained in:
Dmitrii Kovanikov 2024-06-22 11:52:14 +01:00
parent a7ff3e67b7
commit 26dff75139
3 changed files with 14 additions and 10 deletions

View File

@ -1,4 +1,4 @@
version = 0.26.1
version = 0.26.2
profile = default
break-cases = fit-or-vertical
break-infix = wrap-or-vertical

View File

@ -16,4 +16,5 @@ let app = Minttea.app ~init:Init.init ~update:Update.update ~view:View.view ()
let start repo root_dir_path =
let initial_data = init ~repo ~root_dir_path in
let initial_model = Model.initial_model initial_data in
Minttea.start app ~initial_model
let config = Minttea.make_config ~fps:1 () in
Minttea.start ~config app ~initial_model

View File

@ -27,19 +27,22 @@ let move_next (model : Model.t) =
let update event (model : Model.t) =
match event with
(* if we press `q` or the escape key, we exit *)
| Event.KeyDown (Key "q" | Escape) ->
| Event.KeyDown ((Key "q" | Escape), _modifier) ->
(model, Command.Seq [ Command.Exit_alt_screen; Command.Quit ])
(* if we press a digit, we switch to the corresponding tab *)
| Event.KeyDown (Key "1") ->
| Event.KeyDown (Key "1", _modifier) ->
({ model with current_tab = Model.Code }, Command.Noop)
| Event.KeyDown (Key "2") ->
| Event.KeyDown (Key "2", _modifier) ->
({ model with current_tab = Model.Issues }, Command.Noop)
| Event.KeyDown (Key "3") ->
| Event.KeyDown (Key "3", _modifier) ->
({ model with current_tab = Model.PullRequests }, Command.Noop)
(* directions/movements *)
| Event.KeyDown (Up | Key "k") -> (move_up model, Command.Noop)
| Event.KeyDown (Down | Key "j") -> (move_down model, Command.Noop)
| Event.KeyDown (Left | Key "h") -> (move_back model, Command.Noop)
| Event.KeyDown (Right | Key "l") -> (move_next model, Command.Noop)
| Event.KeyDown ((Up | Key "k"), _modifier) -> (move_up model, Command.Noop)
| Event.KeyDown ((Down | Key "j"), _modifier) ->
(move_down model, Command.Noop)
| Event.KeyDown ((Left | Key "h"), _modifier) ->
(move_back model, Command.Noop)
| Event.KeyDown ((Right | Key "l"), _modifier) ->
(move_next model, Command.Noop)
(* otherwise, we do nothing *)
| _ -> (model, Command.Noop)