mirror of
https://github.com/chshersh/github-tui.git
synced 2024-08-16 14:00:30 +03:00
Don't redraw the view on exit
This commit is contained in:
parent
063b01a111
commit
3e8b21dcec
@ -11,6 +11,7 @@ type tab =
|
||||
| PullRequests
|
||||
|
||||
type t = {
|
||||
exit : bool;
|
||||
width : int;
|
||||
height : int;
|
||||
repo : string;
|
||||
@ -31,6 +32,7 @@ let initial_model { repo; root_dir_path; files; width; height } =
|
||||
width;
|
||||
height;
|
||||
repo;
|
||||
exit = false;
|
||||
current_tab = Code;
|
||||
code_tab = { root_dir_path; fs = Fs.zip_it files };
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ let update event (model : Model.t) =
|
||||
match event with
|
||||
(* if we press `q` or the escape key, we exit *)
|
||||
| Event.KeyDown ((Key "q" | Escape), _modifier) ->
|
||||
(model, Command.(Seq [ Exit_alt_screen; Show_cursor; Quit ]))
|
||||
( { model with exit = true },
|
||||
Command.(Seq [ Exit_alt_screen; Show_cursor; Quit ]) )
|
||||
(* if we press a digit, we switch to the corresponding tab *)
|
||||
| Event.KeyDown (Key "1", _modifier) ->
|
||||
({ model with current_tab = Model.Code }, Command.Noop)
|
||||
|
@ -42,4 +42,5 @@ let to_doc (model : Model.t) =
|
||||
empty;
|
||||
]
|
||||
|
||||
let view (model : Model.t) = model |> to_doc |> Pretty.render ~width:model.width
|
||||
let view (model : Model.t) =
|
||||
if model.exit then "" else model |> to_doc |> Pretty.render ~width:model.width
|
||||
|
Loading…
Reference in New Issue
Block a user